[thelist] Excluding tags from a regular expression search
will garrison
willgarrison at gmail.com
Wed Sep 12 13:27:10 CDT 2007
First of all I'm pretty new to regular expressions, so please forgive
my inexperience.
Here's what I'm trying to accomplish:
1. user inputs a search term
2. using provided search term, search through a block of XHTML for matches.
3. highlight the matches
This is working perfectly. The problem however is that when a user
enters an "a", for example, every "a" is highlighted including any "a"
that is within a tag.
When the user enters a search term I am storing it in a variable
called "sp" (for search phrase).
Currently my regular expression looks like this: "/"+sp+"/ig"
I'm trying to find a way to make that regular expression find anything
that matches the search phrase that is not inside of a tag.
Any help would be MUCH appreciated.
Thanks,
Will
More information about the thelist
mailing list