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 16:41

<kosanovic@gmail.com> wrote in message
news:1192204933.239597.226170@v29g2000prd.googlegroups.com...
> Everybody thank you very much for your help. However I coulndn't make
> work any of the examples. The output I get all the time is "Array" and
> that's it.
>
> Steve, image paths are not always in the src value but they are always
> quoted.
> So I thought to make it find .jpg or .png and grab the string on the
> left form the " sign. How would that be in reg exp?

yes...just take the equal sign out of the pattern i gave AND the trailing >.
now, your pattern looks like this:

(["'])?(([^\.]*\.)*(jpe?|pn)g)\1

that will catch a jpg, jpeg, or png where it appears inbetween a set of tics
(') or quotes (").

REMEMBER !!! to debug this and find out where your match will apear within
$matches, do this:

echo '<pre>' . print_r($matches, true) . '</pre>';

please post your results here, so we can either continue to help or, see
that it worked for you.

thx,

me

 

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

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