Reputation: 45
Can anyone tell me why this is not working? I just want to get test.jpg from the url
$html = 'this/large/test.jpg)';
$str = $html;
preg_match('/\/large\/(\d+)\)/',$str, $matches);
echo $matches[1];
Upvotes: 0
Views: 359
Reputation: 56915
Because \d
matches decimals (ie [0-9]
) and test.jpg
is not.
Try preg_match('/\/large\/(.+)\)/',$str,$matches);
.
Upvotes: 2