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

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

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" immediately followed by "all":

var str="Is this all there is";

var patt1=/is(?= all)/g;

The text marked below shows where the expression found matches:

Is th

is

all there is

Try it »


RegExp Object Reference The JavaScript RegExp object