Hello,
Let's suppose that we have such HTML code. We need to get all <a href=""></a>
tags which DO NOT contain img tag inside it.
<a href="http://domain1.com"><span>Here is link</span></a>
<a href="http://domain2.com" title="">Hello</a>
<a href="http://domain3.com" title=""><img src="" /></a>
<a href="http://domain4" title=""> I'm the image <img src="" /> yeah</a>
I'm using this regular expression to find out all links
preg_match_all("!<a[^>]+href=\"?'?([^ \"'>]+)\"?'?[^>]*>(.*?)</a>!is", $content, $out);
I can modify it
preg_match_all("!<a[^>]+href=\"?'?([^ \"'>]+)\"?'?[^>]*>([^<>]+?)</a>!is", $content, $out);
But how can I tell to exclude results containing <img
substring inside of <a href=""></a>
?
Thank you