RegExp [^ abc] expression
Definition and Usage
[^ Abc] expression is used to find any character not between the brackets.
Characters in square brackets can be any character or character range.
grammar
new RegExp("[^xyz]")
或者更简单方式:
/[^xyz]/
或者更简单方式:
/[^xyz]/
Browser Support
All major browsers support [^ abc] expression
Examples
Examples
Character is not in the character range [ah] within the global search:
var str="Is this all there is?";
var patt1=/[^a-h]/g;
var patt1=/[^a-h]/g;
The marked text below shows where the expression gets a match:
Is t h is a ll t he r e is?
try it"
JavaScript RegExp Object