Re: Multiple results in regex [SOLVED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/31/07, Philip Thompson <philthathril@xxxxxxxxx> wrote:
>
> Hi.
>
> I have a string that has multiple references to images in it. I want to
> pull each reference out using regex. I've gotten to where I can pull the
> first instance out, but not ALL of them. I know each image source starts
> with 'images/'. I have this so far....
>
> <?php
> $pattern = '/[\'\"](images\/[a-z0-9\/\-\_\.]+)[\'\"]/i';
> preg_match ($pattern, $string, $matches);
> ?>
>
> // For example, returns...
> Array
> (
>     [0] => "images/some/location/some-image.jpg"
>     [1] => images/ some/location/some-image.jpg
> )
>
> This pulls the first instance, but none of the others. I think what the
> issue is... is that I am stopping after I get the first one, but I don't
> know how to grab the rest. Please help!!
>
> Thanks in advance,
> ~Philip
>



Ummmm nevermind.... brainfart.

preg_match_all()

Cheers,
~Philip

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux