Online Shopping : Computers : Programming : Languages : PHP : Common Problems : Regular Expressions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 26 people (54%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can you list all <img> tag from a html page in a array (using Regular Expressions)

Apr 18th, 2007 00:30
mohd jaffry d jalal, Timon -, http://www.regular-expressions.info/


This regex pattern helped me strip img tags from a html source -
<img[^<>]+>
In PHP, you could implement it like so -
preg_match_all("<img[^<>]+>", $myHTMLsource, $arrayToSaveMatchesIn);