Possible Duplicate:
RegEx match open tags except XHTML self-contained tags
Lets say I’m trying to match the word “google” in a string but sometimes that string contains a link (<a href="http://www.google.com">google</a>) but I only want to match if it’s not a link.
How can I check if there is a <a href="http://www.google.com"> before the word?
The most accurate approach is to:
You don’t want to try parsing HTML with regular expressions. It will make you sad in the long run. Please take a look at http://htmlparsing.com/ for some pointers that could get you started.