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 kosanovic on 10/12/07 17:26

Steve, the arrays are empty. I don't care if it's arrays or not, I
need data.

On Oct 12, 7:00 pm, "Steve" <no....@example.com> wrote:
> <kosano...@gmail.com> wrote in message
>
> news:1192207472.865090.209120@q3g2000prf.googlegroups.com...
>
>
>
> > <?php
>
> > $htmlc=" \"http://example.com/file1.jpg\" kjkjskfj \"http://
> > blabla.com/image2.png\" dsgdg";
> > preg_match_all("/.*(jpg|png)$/", $htmlc, $matches);
> > echo '<pre>' . print_r($matches, true) . '</pre>';
>
> > ?>
>
> > outputs:
> > Array
> > (
> > [0] => Array
> > (
> > )
>
> > [1] => Array
> > (
> > )
>
> > )
>
> look up preg_match_all in the docs or at php.net. regarless of matching or
> not having any results that do match, it will always return an array as a
> result. typically, array[0] will have your exact matches (as another array).
> array[1 - n] contains sub-matches...or partial matches. so,
>
> foreach ($matches[0] as $match)
> {
> echo '<pre>' . $match . '</pre>';
>
> }
>
> will most likely be what you need. make sense?
>
> this is all aside from the fact that the pattern used above doesn't resemble
> anything you've described as your goal...and i'm not even preg. ;^)

 

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

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