Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你好,谁能看到这个正则表达式有什么问题?我从这里得到它并对此进行了测试,一切都检查过了,但我收到了这个错误
分隔符不能是字母数字或反斜杠
这是我的代码
$input = $item_details['description']; $regex = '^[0-9]{9}[[0-9]|X|x]$^'; preg_match($input, $regex, $output); echo ($output);
尝试:
$regex = '/^[0-9]{9}([0-9]|X|x)$/';
或者
$regex = '/^[0-9]{9}[0-9Xx]$/';
$regex = '/^[0-9]{9}[0-9X]$/i';