The following regex gets all images src but shows it with src="
at the begining and "
at the end of the path.
How can I remove it and show only the path?
preg_match('/src="(.*?)"/i' , $content1 , $matches);
Code:
$re = '/(?<=src=")(?:.*?)(?=")/ui';
$txt = '<img src="http://www.gravatar.com/avatar/6f5de9?s=32&d=identicon&r=PG" height="32" width="32" alt="">';
$nMatches = preg_match($re, $txt, $aMatches);
Output:
Array
(
[0] => http://www.gravatar.com/avatar/6f5de9?s=32&d=identicon&r=PG
)