tags:

views:

47

answers:

1

I need to find all the image html tags that are included in a page using PHP regular expressions

Example

<img src="images/image.jpg" />

My code

preg_match('/<img src=\"images\/.*/',$tags,$matches);

The strange thing is it only finds the first occurence, not the rest of the tags in the page

+5  A: 

Use preg_match_all. preg_match only finds the first occurence, while preg_match_all finds all occurrences of the pattern.

Joey
indeed, very easy after the edit :D
Mez
Thx Johann, I can't believe I missed that
Roland