[thelist] Excluding tags from a regular expression search

E Michael Brandt michael at divaHTML.com
Wed Sep 12 15:35:05 CDT 2007

I am now understanding you want to actually highlight the matches on the 
page.  So my solution will, of course, not work as presented.  With an 
even heavier hammer you could do my wort of prematch but append to each 
letter within tags a character that can never exist there, like perhaps 
a ?.  Then do your string matches, and finally remove all the ?'s in 
tags.  Well, I *told* you it was a heavy hammer I am wielding.

The only other way I can think to do this is to loop through the DOM, 
using your regex only in the context you wish, or possibly get only Text 
Elements and then parse them with the regex (if you are only wantng to 
check text elements).


E. Michael Brandt

divaPOP : standards-compliant popup windows
divaGPS : you-are-here menu highlighting
divaFAQ : FAQ pages with pizazz

JustSo PictureWindow
JustSo PhotoAlbum


More information about the thelist mailing list