Page 1 of 1

regular expression for getting images

Posted: Tue Aug 06, 2002 9:57 am
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);

Posted: Tue Aug 06, 2002 3:27 pm
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.

Posted: Wed Aug 07, 2002 8:52 am
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

Posted: Wed Aug 07, 2002 9:28 am
by RandomEngy

Posted: Wed Aug 07, 2002 9:50 am
by 9902468
This site proved to be useful for me:

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

Hope that helps...

Posted: Wed Aug 07, 2002 3:21 pm
by darkshine
:lol: perfet ! RandomScripter
thanks