• Security incident: ISF was recently accessed by intruders. Please change your password, and change it anywhere else you used it. Read more

Anyone a regex guru?

I think this would do the trick:
Code:
<img\b[^>]+\bsrc=(("[^"]+")|('[^']+'))
Indeed it would. However, I think using a back reference would be slightly more elegant (tested now):
Code:
<img\b[^>]+\bsrc=(["'])(.*?)\1
The trick to get this to work properly was to use a non-greedy quantifier, so something like <img src="foo" alt="bar" /> won't return foo" alt="bar in the captured substring. Note that this still won't handle <img src=foo> as allowed by HTML without the X, but frankly, I wouldn't give a damn if this was my own code. :)
 

ISF - Join now!

Every member here is approved by hand. No bots, no spam, just people who care about evidence and honest debate.

Membership is free!

Create your free account

Back
Top Bottom