I am trying to find a regular expression that finds all image tags within a text, that are NOT surrounded by an anchor tag.
The Expression must !not! match the following image tag:
<a href="xxx" >xx<img src="image1">xx</a>
But it must match the tag with image2:
<a href="xxx" >xx<img src="image1">xx</a>xxx
<img src='image2' xx> <div>xx</div>
To get the image source I use the expression:
preg_match_all(/"<img src=\"(.?)\".?>"/i",$string,$array)
somehow this needs to be exented to matchonly the desired image tags...
Thanks in advance