JavaScript RegExp ^Quantifier
JavaScript RegExp Object
Definition and Usage
^nThe quantifier matches any string that begins withnthe string.
Syntax
new RegExp("^n")
or
/^n/
or
/^n/
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the ^ quantifier.
Example
Example
Perform a global search for "Is" at the beginning of the string:
var str="Is this his";
var patt1=/^Is/g;
var patt1=/^Is/g;
Belowmarkedtext shows where the expression obtained a match:
Is this his
Try it Yourself »
JavaScript RegExp Object Other Extensions