Forwarded to the list for suggestions...my regex is pretty rusty... ---------------------- I've got a string full of HTML, and I'd like to highlight specific words in the text by surrounding it with <span class="highlight"></span> tags. That's pretty simple: $strIn = eregi_replace("([^a-z'-])($highlight)([^a-z'-])", "\\1<span class=\"highlight\">\\2</span>\\3", $strIn); I gets difficult when I want to exclude any instances of the word that happen to be within an HTML tag. Otherwise I could end up with <a href="http://site.com/<span class="highlight">highlight</span>/default.htm">, for example, and that's no good. The following regex is the closest I've gotten (it's just the previous one plus another subexpression), but it doesn't match anything at all. It seems like it should work to me, though: $strIn = eregi_replace("([^a-z'-])($highlight)([^a-z'-])([^<>]*>)^", "\\1<span class=\"highlight\">\\2</span>\\3", $strIn); If any regex-wizzes could help me out with this one, I'd be extra grateful. thanks, -josh * [ www: endquote.com ] [ icq: 940141 ] [ aim: endquote ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]