I didn't test this in PHP, I'm more familiar with the Perl Regex, but this
might work for you, play with it:

/<img\s*src=([^ ]*)/

note: \s = whitespace and the [^ ] means any nonspace character... the only
issue remaining that you might find "s or 's around the string matched into
the ().

- e r i c k

-----Original Message-----
From:   Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]]
Sent:   Friday, July 13, 2001 9:04 AM
Subject:        [PHP] Regex Help

I am trying to write a script that needs a list of all the images in an HTML

I am trying this code

    if (eregi ("(<img.+src=)(.+)[\s>]",$buffer, $regs ))
      echo "$regs[2]<BR><BR>";

The problem, however is that when it looks at

<IMG SRC=images/Logo.gif ALT="Only Child Club - The Place for Only

instead of getting images/Logo.gif like I want I am getting

images/Logo.gif ALT="Only Child Club - The Place for Only Children"

I am not as familiar with Regexes as I would like and any help would be
greatly appreciated


Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to