'how to create regular expression which not allow semi colon, colon single quote and double quote
i am trying to create a regular expression which is not allow semi colon, colon single quote and double quote
var address=/^[\u0022\u0027\u003A\u003B]{1,50}$/
address.test(value);
this my code
this code is run only when textbox contain only ; : ' "
if ;123 this code is not run
please help me
Solution 1:[1]
Add a circumflex (^) character after the opening bracket ([), to indicate negation (“any character but…”):
var address=/^[^\u0022\u0027\u003A\u003B]{1,50}$/
Without it, the expression tests that the value is a string containing only the characters that you actually wish to exclude.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jukka K. Korpela |
