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 Captain Paralytic on 10/12/07 15:28

On 12 Oct, 16:12, kosano...@gmail.com wrote:
> 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>";
> }
>
> without much success. Anybody can correct this to make it work?

Try:
preg_match_all("/.*(jpg|png)$/", $htmlfile, $Matches);

 

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

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