Reputation: 3088
Not sure why it's not working. Simulated this regexp online at http://regex.larsolavtorvik.com/ and it worked. But not in my PHP.
$val = 'IMG_BE0801s.jpg';
preg_match('/([A-Z]{2}[0-9]{4})/i',$val,$res);
print_r($res);
Please help.
Upvotes: 0
Views: 55
Reputation: 222198
Works for me.
php> $val = 'IMG_BE0801s.jpg';
php> preg_match('/([A-Z]{2}[0-9]{4})/i',$val,$res);
php> print_r($res);
Array
(
[0] => BE0801
[1] => BE0801
)
Upvotes: 1