regular expression for getting images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ludal
Forum Newbie
Posts: 4
Joined: Mon Jul 15, 2002 6:07 pm

regular expression for getting images

Post by ludal »

Please , how select single quotes too...i want to parse an html page to bring back images.... so at the moment it gets only " " but not ' '...

idea??

Code: Select all

preg_match_all('/"(ї^"]+\.('.implode('|', $extensions).'))"/Ui', $contenu, $images);
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

You could do another match:

Code: Select all

preg_match_all('/''(ї^'']+\.('.implode('|', $extensions).'))''/Ui', $contenu, $images);
That would match ' '. If you want to match " ' and " ', you could do:

Code: Select all

preg_match_all('/(''|")(ї^(''|")]+\.('.implode('|', $extensions).'))(''|")/Ui', $contenu, $images);
That would return " " and ' ' as well. I havn't tested it though. Keep in mind the extra backreferences in that last one will change the backreference to get the actual image name.
darkshine
Forum Newbie
Posts: 15
Joined: Wed Aug 07, 2002 4:15 am
Location: paris, france

Post by darkshine »

I ' m in trouble with reg exp...
Is there an complete documentation for learning reg exp ?
i m in, trouble finding a good one
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

User avatar
9902468
Forum Commoner
Posts: 89
Joined: Thu Jun 06, 2002 6:39 am
Location: Europe

Post by 9902468 »

This site proved to be useful for me:

http://www.phpbuilder.com/columns/dario19990616.php3

Hope that helps...
darkshine
Forum Newbie
Posts: 15
Joined: Wed Aug 07, 2002 4:15 am
Location: paris, france

Post by darkshine »

:lol: perfet ! RandomScripter
thanks
Post Reply