• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

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. :)
 

Back
Top Bottom