brummschaedel: preg_match_all

Beitrag lesen

hallo

preg_match_all("/<img[^>]*src="([^"]*s_[a-z0-9]+.(jpg|bmp|gif))"[^>]*>/i",$str,$match);

das sucht mir aus einem quellcode, in allen image-tags den pfad von der quelle (src="") raus. das klappt eigendlich auch ganz gut. als ergebnis wird folgendes geliefert:

Array
(
    [0] => Array
        (
            [0] => <img src="/img/news/s_1179174dfgs18s0.gif" border="0" alt="" hspace="5" vspace="5" width="260" height="175" align="right" />
            [1] => <img src="/img/news/s_1179sfdgdgdfd4180.jpg" border="0" alt="" hspace="5" vspace="5" width="260" height="175" align="right" />
        )

[1] => Array
        (
            [0] => /img/news/s_1179174dfgs18s0.gif
            [1] => /img/news/s_1179sfdgdgdfd4180.jpg
        )

[2] => Array
        (
            [0] => gif
            [1] => jpg
        )

)

aber wie bekomm ich es hin das im ergebnis

[2] => Array
        (
            [0] => gif
            [1] => jpg
        )

nicht mit drin steht ?

gruesse