JavaScript RegExp ?=Quantifier

RegExp 对象参考手册JavaSript RegExp Object

Definition and Usage

?=nThe quantifier matches any string that is immediately followed by the specifiednstring.

Syntax

new RegExp("regexp(?=n)")

Or

/regexp(?=n)/


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the ?= quantifier


Example

Example

Do a global search for "is" immediately followed by "all":

var str="Is this all there is";
var patt1=/is(?= all)/g;

Belowmarkedtext shows the position where the expression gets a match:

Is this all there is

Try it yourself »


RegExp 对象参考手册JavaSript RegExp Object Other Extensions