|
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]
|