Return to Snippet

Revision: 5483
at March 13, 2008 00:46 by melvitax


Updated Code
$str = '<h2> this is a test</h2><img src="pathrourl.jpg" alt="test" />';
$find = '/<img.*src="(.*?)"/';
$match = preg_match($find, $str, $img );
if ( $match ) 
	echo $img[1];

Revision: 5482
at March 11, 2008 15:05 by melvitax


Updated Code
$str = '<h2> this is a test</h2><img src="pathrourl.jpg" alt="test" />';
$find_src = '<img src="(.*?)".*?>';
$match = preg_match($find_src, $str, $img );
if ( $match ) 
	echo $img[1];

Revision: 5481
at March 11, 2008 14:57 by melvitax


Initial Code
$str = '<h2> this is a test</h2><img src="pathrourl.jpg" alt="test" />';
$find_src = '<img src="(.*?)".*?>';
$match = preg_match($find_src, $str, $img );
if ( $match ) 
	echo $img[0];

Initial URL

                                

Initial Description

                                

Initial Title
Grab SRC from IMG tag

Initial Tags

                                

Initial Language
PHP