你好,有人能看到这个正则表达式有什么问题吗?我从here上得到了它,并在this上对它进行了测试,所有这些都得到了检验,但我得到了这个错误
分隔符不能是字母数字或反斜杠
以下是我的代码
$input = $item_details['description']; $regex = '^[0-9]{9}[[0-9]|X|x]$^'; preg_match($input, $regex, $output); echo ($output);
发布于 2012-06-01 14:49:35
尝试:
$regex = '/^[0-9]{9}([0-9]|X|x)$/';
或
$regex = '/^[0-9]{9}[0-9Xx]$/';
$regex = '/^[0-9]{9}[0-9X]$/i';
https://stackoverflow.com/questions/10845613
相似问题