Latest web development tutorials

RegExp ^ quantifier

RegExp Object Reference JavaSript RegExp objects

Definition and Usage

^ nquantifier matches any string beginning with then.

grammar

new RegExp("^n")

或者

/^n/


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support ^ quantifier.


Examples

Examples

String beginning with "Is" a global search:

var str="Is this his";
var patt1=/^Is/g;

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

Is this his

try it"


RegExp Object Reference JavaSript RegExp objects