Sheridan,

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
To:     [EMAIL PROTECTED]
Subject:        [PHP] Regex Help

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

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
Children">

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

Thanks

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP General Mailing List (http://www.php.net/)
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