I am trying to extract the src value from a tag,
so far I seem to be able to extract the string between the src value and the final quotation mark in the string
String:
<img border="0" src="http://i.bookfinder.com/about/booksellers/logo_borderless/amazon_uk.gif" width="89" height="31" alt="">
e.g. in PHP:
preg_match('/src=\"(.*)\"/', $row->find('a img',0), $matches);
if($matches){
echo $matches[0];
}
prints out
src="http://i.bookfinder.com/about/booksellers/logo_borderless/amazon_uk.gif" width="89" height="31" alt=""
but what i really want printed is…
src="http://i.bookfinder.com/about/booksellers/logo_borderless/amazon_uk.gif"
or if possible just…
http://i.bookfinder.com/about/booksellers/logo_borderless/amazon_uk.gif
what should I be adding to the regex? Thanks
For RegExp:
If i’m right, you are working with simple_html_dom_parser library. If that’s true you can just type: