is this a limitation on any regex result?
What I need is to get all the occurrence in a single line, but preg_match_all
return the first and end of the expression.
Is there any other way to get all the occurrence on the line?
$re = "/(media|images)(.*)(.jpg|.jpeg|.png)/";
$str = 'images/test/test-1.png" alt="test-1" /></a><a href="/test-2" title="test 2"><img src="/images/test/test2.png" alt="test2" /></a> <a href="/test-3" title="Cruises in Croatia"><img src="/images/EET/test-3.png';
preg_match_all($re,$str,$matches );
print_r($matches);
This is what I get.
Array
(
[0] => Array
(
[0] => images/test/test-1.png" alt="test-1" /></a><a href="/test-2" title="test 2"><img src="/images/test/test2.png" alt="test2" /></a> <a href="/test-3" title="Cruises in Croatia"><img src="/images/EET/test-3.png
)
[1] => Array
(
[0] => images
)
[2] => Array
(
[0] => /test/test-1.png" alt="test-1" /></a><a href="/test-2" title="test 2"><img src="/images/test/test2.png" alt="test2" /></a> <a href="/test-3" title="Cruises in Croatia"><img src="/images/EET/test-3
)
[3] => Array
(
[0] => .png
)
)