JavaScript RegExp [^abc]Expression
JavaScript RegExp Object
Definition and Usage
The [^abc] expression is used to find any character not between the brackets.
The characters inside the brackets can be any characters or a range of characters.
Syntax
new RegExp("[^xyz]")
Or a simpler way:
/[^xyz]/
Or a simpler way:
/[^xyz]/
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the [^abc] expression.
Example
Example
Perform a global search for characters not in the range [a-h]:
var str="Is this all there is?";
var patt1=/[^a-h]/g;
var patt1=/[^a-h]/g;
The marked text belowmarkedshows where the expression gets a match:
Is this all there is?
Try it Yourself »
JavaScript RegExp Object
Other Extensions