Page 1 of 1
Replacing HTML tags around pieces of text
Posted: Tue Jun 03, 2008 8:07 pm
by seanap
First off I've got to say I LOVE TextPad! But anyways, I'm trying to replace the HTML tags around certain portions of text as to quickly assist in moving a file over to a CSS style sheet.
What I'm trying to replace looks like this:
Code: Select all
<TD WIDTH="50" ALIGN="RIGHT" ><FONT SIZE="3"><STRONG><FONT COLOR="BLACK">88</STRONG></FONT></TD>
and I would want to replace it with something like this:
I'm sort of new to Regular Expressions, so any help and guidance would be greatly appreciated!
Posted: Sat Jun 07, 2008 8:16 pm
by gan
It'a always a bit hard to give a working example with only one line of example since the other lines might be different and the example might not work for those lines. Anyway for your current example this one should work:
Search for:
And replace with:
I don't know what the rest of the lines look like so might be some lines where it doesn't match correctly. In that case you need to provide some more lines in your example and include the lines where this doesn't work. Maybe some small adjustments is required to make it work or maybe it's a bit harder then it seems.
Posted: Sat Jun 07, 2008 9:00 pm
by seanap
I'm not at work right now (won't be until Monday) so I can't provide any more examples, however the majority of the lines that need to be replaced are very similar to that, i.e. just different widths or attributes, etc.
I'll give what you posted a try as soon as I can.
Thanks for the reply, I do greatly appreciate it!
Posted: Sun Jun 08, 2008 10:32 pm
by Bob Hansen
The real complication in this example will be if the closing tag is not always on the same line.
If the information inside the tags goes across more than one line, then you may have to do multiple passes, each one designed to handle a different number of enclosed lines.
So a good sample of lines should be included showing all combinations to be searched.....