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"><asplaceHolder ID="PlaceHolder75"
runat="server"></asplaceHolder></td>
and make it into this:
<td align="center" ID="PlaceHolder75"></td>
Important points are these:
1. the <asplaceHolder... /> is being removed entirely, with nothing
inserted in it's place.
2. the <td> located immediately before the <asplaceHolder /> gets the
"ID=" value of the [removed] <asplaceHolder />.
none of the <td> tags already have any ID attribute (this fact should
simplify the operation).
3. A given input string may have multiple <asplaceHolder /> controls - all
of which need to be removed, with the ID attribute of each being inserted
into the <TD> immediately preceeding the [removed] <asplaceHolder />
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"><asplaceHolder ID="PlaceHolder75"
runat="server"></asplaceHolder></td>
and make it into this:
<td align="center" ID="PlaceHolder75"></td>
Important points are these:
1. the <asplaceHolder... /> is being removed entirely, with nothing
inserted in it's place.
2. the <td> located immediately before the <asplaceHolder /> gets the
"ID=" value of the [removed] <asplaceHolder />.
none of the <td> tags already have any ID attribute (this fact should
simplify the operation).
3. A given input string may have multiple <asplaceHolder /> controls - all
of which need to be removed, with the ID attribute of each being inserted
into the <TD> immediately preceeding the [removed] <asplaceHolder />
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