F
Franklin
Using .NET 3.5...
My understanding is that RegEx is powerful enough to solve most of the
world's problems...so I'm optimistic about this scenario:
I need to automate a not-so-straight-forward search and replace operation on
strings that contain HTML markup fragments.
I need to take a string like this:
<td align="center"><asp
laceHolder ID="PlaceHolder75"
runat="server"></asp
laceHolder></td>
and make it into this:
<td align="center" ID="PlaceHolder75"></td>
Important points are these:
1. the <asp
laceHolder... /> is being removed entirely, with nothing
inserted in it's place.
2. the <td> located immediately before the <asp
laceHolder /> gets the
"ID=" value of the [removed] <asp
laceHolder />.
none of the <td> tags already have any ID attribute (this fact should
simplify the operation).
3. A given input string may have multiple <asp
laceHolder /> controls - all
of which need to be removed, with the ID attribute of each being inserted
into the <TD> immediately preceeding the [removed] <asp
laceHolder />
So, from those of you with significant regex experience, can regex do this?
Any pointers are greatly appreciated. Sample code would be awesome, as
learning regex is a huge task that I've started, but yet have a long way to
go.
- F
My understanding is that RegEx is powerful enough to solve most of the
world's problems...so I'm optimistic about this scenario:
I need to automate a not-so-straight-forward search and replace operation on
strings that contain HTML markup fragments.
I need to take a string like this:
<td align="center"><asp

runat="server"></asp

and make it into this:
<td align="center" ID="PlaceHolder75"></td>
Important points are these:
1. the <asp

inserted in it's place.
2. the <td> located immediately before the <asp

"ID=" value of the [removed] <asp

none of the <td> tags already have any ID attribute (this fact should
simplify the operation).
3. A given input string may have multiple <asp

of which need to be removed, with the ID attribute of each being inserted
into the <TD> immediately preceeding the [removed] <asp

So, from those of you with significant regex experience, can regex do this?
Any pointers are greatly appreciated. Sample code would be awesome, as
learning regex is a huge task that I've started, but yet have a long way to
go.
- F