[thelist] Regexp help?
Joshua Olson
joshua at waetech.com
Fri Sep 19 11:41:29 CDT 2003
----- Original Message -----
From: "Dougal Campbell" <dougal at gunters.org>
Sent: Friday, September 19, 2003 12:05 PM
> I've been searching for a regexp that will let me do text replacements
> inside HTML text, but not within HTML tags themselves. In other words,
> if I had content like this:
>
> <a href="/meta/RSS.xml" title="My RSS feed">Our RSS 2.0 feed</a>
Givent the above string, you could use the following two regex's to
correctly identify the start and the end tag:
Start tag:
<a([\s]+[a-zA-Z]+[\s]*=[\s]*("([^"]*)"|'([^']*)'))*[\s]*>
End tag:
</a>
Once you've indentified those matches it should be fairly trivial to replace
RSS within the text between the tags.
HTH,
<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168
More information about the thelist
mailing list