REGEXP preg_replace验证模型/部件号

时间:2011-12-04 05:26:59

标签: php regex

我需要一个脚本,以便能够使用alpanumeric和“/”(斜杠)和“ - ”(短划线)在搜索框中查找部件号。这是我到目前为止所做的:

$query[] = "(a.name REGEXP '( )*(" . implode("|", explode(" ", preg_replace("/ +/", " ", $basic_search))) . ")( )*')";

1 个答案:

答案 0 :(得分:1)

/^[\w+\-\/]+$/之类的东西?或/^[a-zA-Z0-9\-\/]+$/,因为\w将包含_