How do I allow spaces in this regex?

前端 未结 6 1359
渐次进展
渐次进展 2021-01-12 02:05

I\'m such an amateur at regex, how do I allow spaces(doesn\'t matter how many) in this regex?

if(preg_match(\'/[^A-Za-z0-9_-]/\', $str)) return FALSE;
         


        
6条回答
  •  佛祖请我去吃肉
    2021-01-12 02:42

    Not so much an answer to your question, but a site I find useful for checking regex expressions. It also explains what each part of the expression does / means as you hover over it in the input field.

提交回复
热议问题