RegExp ^ quantifier
Definition and Usage
^ nquantifier matches any string beginning with then.
grammar
new RegExp("^n")
或者
/^n/
或者
/^n/
Browser Support
All major browsers support ^ quantifier.
Examples
Examples
String beginning with "Is" a global search:
var str="Is this his";
var patt1=/^Is/g;
var patt1=/^Is/g;
The marked text below shows where the expression gets a match:
Is this his
try it"
JavaSript RegExp objects