Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

RegExp ?! quantifier

JavaScript RegExp ?! quantifier

RegExp Object Reference The JavaScript RegExp object


Definition and Usage

The ?!n The quantifier matches any string not immediately followed by the specified string n .

Syntax

new RegExp("

regexp

(?!

n)

")

or

/

regexp

(?!

n)

/


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the ?! quantifier.


Example

Example

Perform a global search for "is" not immediately followed by "all":

var str="Is this all there is";

var patt1=/is(?! all)/gi;

The text marked below shows where the expression found matches:

Is

this all there

is

Try it »


RegExp Object Reference The JavaScript RegExp object