faqts : 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?

11 of 23 people (48%) answered Yes
Recently 5 of 10 people (50%) 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);