allow parentheses and other symbols in regex

前端 未结 5 1007
醉话见心
醉话见心 2020-12-15 14:18

I\'ve made this regex:

^[a-zA-Z0-9_.-]*$

Supports:

letters [uppercase and lowercase]
numbers [from 0 to 9]
underscores [_]
         


        
5条回答
  •  爱一瞬间的悲伤
    2020-12-15 14:50

    Try escaping your regex: [a-zA-Z0-9\-\(\)\*]

    Check if this help you: How to escape regular expression special characters using javascript?

提交回复
热议问题