.match() with a regular expression returns null

前端 未结 3 2078
遥遥无期
遥遥无期 2020-12-17 08:29

I am trying to do something I thought would be pretty easy to do, which is to restrict a string to certain characters by matching a regular expression.

var v         


        
3条回答
  •  醉酒成梦
    2020-12-17 09:02

    Your code looks like it's inside a function { ... }. Are you returning anything? If not, that's why you're getting null back...

    Also, regexes are surrounded by slashes (/.../), not quotes.

提交回复
热议问题