Pretty tough regex
Posted: Tue Jun 02, 2009 4:23 pm
...at least for me being a relatively "light" regex user. Fellas, I need your help as you are my last resort after few days of worthless googling and experimenting
I am trying to construct a regex for keyword autolink in html. the keyword should only match if it's
(1) outside a html tag and
(2) not between the <a..></a> tags since this would mean it is already a part of a link and shouldn't be autolinked again.
So, in the following code if I am looking to autolink "apple":
The regex should only match the first apple since all the rest are either a part of a tag or between the Anchor tag.
Any tips would be greatly appreciated!!
I am trying to construct a regex for keyword autolink in html. the keyword should only match if it's
(1) outside a html tag and
(2) not between the <a..></a> tags since this would mean it is already a part of a link and shouldn't be autolinked again.
So, in the following code if I am looking to autolink "apple":
Code: Select all
The big red apple was growing on an <a href="appletree.com" title="apple tree">Apple Tree</a>
<img src="apple.gif" title="apple tree">
Any tips would be greatly appreciated!!