Forum Moderators: coopster

Message Too Old, No Replies

Regex Problem

         

rfontaine

3:36 pm on Nov 3, 2004 (gmt 0)

10+ Year Member



Hi,

I am looking for a regex to match something like this:

<img src="http://xyz.jpg" alt="anything" width="x" height="y" />

What I mean is match anything that is between the "<img" and the "/>"

I am terrible at this sort of thing and have attempted this, which does not seem to work:

/<img(.*)\/>/Usi

Any help appreciated,
Thank you in advance

mincklerstraat

4:27 pm on Nov 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try:
/<img([^>]*)\/>/Usi
,
might work (instead of 'and match any character here, unlimited no. of characters' does 'match any character except >')

rfontaine

5:34 pm on Nov 3, 2004 (gmt 0)

10+ Year Member



Excellent! Thank you very much, it works :-)

coopster

7:11 pm on Nov 3, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The first one should have worked, too. Works fine for me.