JavaScript RegExp ?! Quantifier

Definition and usage

?!n Quantifiers to match any string that is not immediately followed by a specified string n string.

Tip:Use ?=n Quantifiers to match any string that is immediately followed by a specified string n string.

Example

Perform a global, case-insensitive search for "is", followed by not immediately followed by "all":

let text = "Is this all there is";
let pattern = /is(?! all)/gi;

Try it yourself

Syntax

new RegExp("regexp(?!n)

or abbreviated as:

/regexp(?!n)/

Syntax with modifiers

new RegExp("regexp(?!n)", "g")

or abbreviated as:

/regexp(?!n)/g

Browser supports

/(?!n)/ er ECMAScript1 (ES1) egenskaber.

Alle browsere understøtter fuldt ud ES1 (JavaScript 1997):

Chrome IE Edge Firefox Safari Opera
Support Support Support Support Support Support