You are here: Re: Regular Expression to extract all .JPG and .PNG URL's « PHP Programming Language « IT news, forums, messages
Re: Regular Expression to extract all .JPG and .PNG URL's

Posted by Steve on 10/12/07 15:27

<kosanovic@gmail.com> wrote in message
news:1192201960.982311.106940@i13g2000prf.googlegroups.com...
> Hello,
> I'm bad at regular expressions. Would somebody help me:
> I need to extract all URL to .jpg and .png pictures from a string
> containing an HTML file (DOM wouldn't work well in what I need).
>
> I've tried:
>
> preg_match_all("/.jpg$|.png$/", $htmlfile, $Matches);
> foreach ($Matches as $match)
> {
> echo $match."<br>";
> }

\.(jpe?g|png)\b+$?

that should cure what ailes you. this is free handed, but after eyeballing
regex for years, i'm pretty sure it will work 'outta the box'.

cheers

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация