[英]php regex to match a single letter after digits
I've got the following regex to see if $string contains digits followed by letters. 我有以下正则表达式,看看$ string是否包含数字后跟字母。 However, I need it to check only that it contains 1 letter after the numeric value.
但是,我需要它只检查它在数值后面包含1个字母。 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是28AB,那么它也会匹配正则表达式,但不应该,它应该只匹配任何数字后跟一个字母。
$string = "28A";
$containsSpecial = preg_match('/[d\^a-zA-Z]/', $string);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.