3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $regex='#^(<[^>]+>)*<img#i'; var_dump(preg_match($regex,'<p><span><a href=""><img src="some.jpg"></a></span></p>')); var_dump(preg_match($regex,'<p>Text text text<span><a href=""><img src="some.jpg"></a></span></p>')); var_dump(preg_match($regex,'<p><span>Text text text<a href=""><img src="some.jpg"></a></span></p>'));
Output for 4.3.0 - 7.1.0
int(1) int(0) int(0)