RE: [PHP] Regex Help

From: Date: Fri, 13 Jul 2001 18:50:59 +0000
Subject: RE: [PHP] Regex Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57788@lists.php.net to get a copy of this message
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:webmaster@foxjet.com] Sent: Friday, July 13, 2001 9:04 AM To: php-general@lists.php.net 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

« previous php.general (#57788) next »