preg_match - 我在哪里犯错?

Ste*_*goo 1 php regex preg-match

朋友们,我正赶往最后期限,我认为这会让我做出幼稚的错误.这里我有验证需要正则表达式,每次我输入有效表达式preg_match返回false.现在很久我想要发现错误,但我不能!我用Google搜索和AFAICS,事情似乎没问题请帮我发现错误.谢谢,斯特凡诺

<?php

$string = "37961/T.08";//valid ID, it is supposed to match
$regex = '/^[0-9]{5,}/[a-zA-Z]\.[0-9]{2,}/';
if (preg_match($regex, $string)) {
    echo 'matched expression!';
}  else {
    echo 'unmatched expression pattern';//comes here instead of valid regex!
}

?>
Run Code Online (Sandbox Code Playgroud)

Cfr*_*eak 8

看起来你需要逃避你的 /

$regex = '/^[0-9]{5,}\/[a-zA-Z]\.[0-9]{2,}/';
Run Code Online (Sandbox Code Playgroud)