Regular Expression to validate only A-Z, a-z, 0-9, space, period, hyphen - exclamation mark ! question mark ? quotes "

前端 未结 3 1759
梦如初夏
梦如初夏 2021-01-14 08:03

I want to use regular expression which validate the text which user enter.

/^[a-zA-Z0-9 ]+$/

By above line, we can allow only Alphabetic,

3条回答
  •  不要未来只要你来
    2021-01-14 08:08

    You just need to include this extra symbols in the character class you have in your regex.

    You can use this regex:

    /^[a-zA-Z0-9 "!?.-]+$/
    

提交回复
热议问题