JavaScript RegExp ?!Quantifier
JavaScript RegExp Object
Definition and Usage
The ?!nThe quantifier matches that is not immediately followed by the specified stringnany string.
Syntax
new RegExp("regexp(?!n)")
or
/regexp(?!n)/
or
/regexp(?!n)/
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the ?! quantifier.
Example
Example
Perform a global search for "is" that is not immediately followed by "all":
var str="Is this all there is";
var patt1=/is(?! all)/gi;
var patt1=/is(?! all)/gi;
Belowmarkedtext shows the position where the expression obtained a match:
Is this all there is
Try it Yourself »
JavaScript RegExp Object Other Extensions