I've been struggling with this due to my lacking REGEX experience. I need to extract the pattern of all img tags in html which occur inside p tags. i.e:
<p>Hello <img src="bbc.co.uk" /> World</p>
<img src="google.com" />
<p>Crazy <img src="google.com"> Town</p>
Should return:
<img src="bbc.co.uk" />
<img src="google.com">
I have this regex so far which captures the img pattern:
<img .+?(?=>)>
However it captures all imgs, where as I need only those that appear within a p tags, but do NOT want the p tag to be included in the result.
Many thanks