include dot(.) and hyphen(-) in a regex

后端 未结 4 1145
误落风尘
误落风尘 2021-01-29 12:56
 if(preg_match(\'/[^a-z\\-0-9]/i\', $value))

    {
    echo \"\";
}

how

4条回答
  •  既然无缘
    2021-01-29 13:01

    Assuming you are talking about the regex, you escape both with a slash \.

    /[^a-z\.\-0-9]/i
    

提交回复
热议问题