I'm trying to write a regex that matches any <img />
tag followed with a space, followed with some text.
In other words, I want these lines to be matched:
Hello <img /> world!
<span>Hello <img /></span> world!
<span>Hello <img /> </span>world!
But not those ones:
Hello <img />!
<span>Hello <img /></span>!
<span>Hello </span> world!
<span>Hello <img /></span>my world!
While I managed to match images using <img[\w\W]+?\/>
, I can't figure out how to match the space followed with text, especially when some closing tags are located in between...
See RegExr here.