Regex help with html tags
Posted: Wed Sep 22, 2010 3:28 am
Hello,
I am having trouble with regex, which I need it to figure out if a <a> tag contains a link that points to a website outside the current website. For example,
<a href="http://www.example.com/login">link</a>
I need regex to check to see if the the "http://www.example.com" exists in the tag or not, if it doesnt then I need it to replace the whole tag with "" as a form to delete it. I have been trying to figure out how to do that but failed, please help me.
Edit-- The tags exist in a single string, so I need it to find <a> tags as well
I am having trouble with regex, which I need it to figure out if a <a> tag contains a link that points to a website outside the current website. For example,
<a href="http://www.example.com/login">link</a>
I need regex to check to see if the the "http://www.example.com" exists in the tag or not, if it doesnt then I need it to replace the whole tag with "" as a form to delete it. I have been trying to figure out how to do that but failed, please help me.
Edit-- The tags exist in a single string, so I need it to find <a> tags as well