Re: Multiple results in regex [SOLVED]



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


Relevant Pages

  • Multiple results in regex
    ... I have a string that has multiple references to images in it. ... I've gotten to where I can pull the first ...
    (php.general)
  • Re: flame sprayer?
    ... Trans-Oceanic Royal D7000 and the Pentax ME Super) was a rather ... I believe it uses CO2 cartridge to ... carry a string..Got lots of string spools, ... cock it..and pull the trigger..a piston with a spike on the end slams ...
    (rec.crafts.metalworking)
  • Re: Help for Harlans Pull
    ... Function pull(xref As String) As Variant ... pull = CVErr ... On Error GoTo CleanUp 'immediate clean-up at this point ... >> Dave Peterson ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Perpetum mobile
    ... A string makes it pull, ... pull very strongly, especially when the ball drops, like a rubber, the ... string makes the metal ball go down and bounce back, ...
    (sci.astro)
  • Re: Perpetum mobile
    ... A string makes it pull, ... So anyway, imagine a spring that has a big heavy metal ball, and the ... and this rolling creates some electricity, a little, just enough to ...
    (sci.astro)