Reputation: 7067
I've got the following regex to see if $string contains digits followed by letters. However, I need it to check only that it contains 1 letter after the numeric value. Although the code below works, if $string was to be 28AB then it will also match the regex but it shouldn't, it should only match any numeric value followed by a single letter.
$string = "28A";
$containsSpecial = preg_match('/[d\^a-zA-Z]/', $string);
Upvotes: 4
Views: 2193