>I would like to search a piece of text for any instance of a word or >phrase, unless it is inside a set of anchor tags. > >I.E. Search for 'Foobar' and find it in 'This is a Foobar example, but >I do not want to find this <a href="foobarLink.cfm">Foobar<a> instance >of the word.' > >I know I got an example of how to do this a couple of years ago, but I >can no longer find it in the regex list archive.
Hi Ian, try stripping out all the text inside of any HTML tags. A RegEx to strip between a set of tags is: <tag>([^>]*)<\/tag>. Modifying it a bit to get rid of any tag, I ended up with: <[^>]*>([^>]*)<\/[^>]*> So....if you do <cfset content = reReplaceNoCase(content, "<[^>]*>([^>]*)<\/[^>]*>", "", "all") /> You will have your content with all text in between HTML tags stripped. You can then search that content for whatever you are looking for. There is probably an easier way using reFind or reMatch but I am fairly new to regular expression's and am not sure how to go about it. Hth, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/regex/message.cfm/messageid:1178 Subscription: http://www.houseoffusion.com/groups/regex/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.21
