There are many regular expressions to match the url. However, I am trying to match URLs that do not appear anywhere in the hypertext tag <a>( HREF, internal value, etc.). Therefore, NONE of the URLs in them must match:
<a href="http://www.example.com/"> something </a>
<a href="http://www.example.com/"> http://www.example2.com </a>
<a href="http://www.example.com/"> <b> something </b> http://www.example.com/ <span> test </span> </a>
Any outside url <a></a>must be matched.
One approach that I tried to use is to use a negative lookahead to see if the first tag <a>after the URL was an open <a>or close </a>. If this is a close </a>, then the URL should be inside the hyperlink. I think this idea was fine, but a negative regex did not work (or rather, the regex was spelled incorrectly). Any advice is greatly appreciated.
source
share