ISBN 搜索的正则表达式错误


regex error with ISBN 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';