How to allow only "numbers","-" and "()" using JavaScript
var filter =/^[0-9]+$/
But now I have to also allow hyphen and "()".
Please provide me a way for the same.How about:
/^[0-9()-]+$/
Notes:
- Parenthesis have no special meaning in a character set
- If you start, or end, with a minus-sign, it is not interpreted as a range, but as the minus-character itself
精彩评论