Latest web development tutorials

RegExp?! Quantifier

RegExp Object Reference JavaSript RegExp objects

Definition and Usage

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

grammar

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

或者

/regexp(?!n)/


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support?! Quantifiers.


Examples

Examples

Not keeping up with "all" the "is" a global search for them later:

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

The marked text below shows where the expression gets a match:

Is this all there is

try it"


RegExp Object Reference JavaSript RegExp objects