JavaScript RegExp ^ Modifier
Complete RegExp Object Reference
Definition and Usage
When the ^ modifier is set the regular expression gets a match at the
beginning of the string.
Syntax
new RegExp("^regexp")
OR
/^regexp/
|
Parameter |
Description |
regexp |
Required. The rest of the regular expression to use |
Example
In the following code we will do a search for "Is" at the beginning of the
string:
var str = "Is this all there is?";
var patt1 = new RegExp("^Is");
|
The marked text below shows where the RegExp gets a match:
Try-It-Yourself Demos
^
How to use the "^" modifier to search in the beginning of a string using a
string object.
^
How to use the "^" modifier to search in the beginning of a string using a
regular expression object.
Complete RegExp Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|