JavaScript Regex ^ Quantifier18 Mar 2025 | 5 min read JavaScript regular expression uses the "^" quantifier to contain input characters at the start of the string. The ^ quantifier filters the value at the beginning of input information using methods. The modifier operates with the regexp method and quantifier to operate, replace, search, and match data. SyntaxThe following syntax uses the regex "^" quantifier to get unavailable characters. Or Or Description
Supported browsersThe given browsers operate for the javascript regular expression's "^" quantifier.
ExamplesThe examples work with different methods, values, and modifiers using the regular expression of the "^" quantifier in JavaScript. Example1 The example uses the match() method with the different values for the regex quantifier. The first value shows null output, and the second value shows the available value at the start of the string. Output The output shows the available characters at the start of the string. ![]() Example 2 The example uses the match() method with the global and case-insensitive modifier for the regex quantifier. We can see the difference between the two modifiers with the string. Output The output shows the available characters at the start of the string. ![]() Example 3 The example uses the quantifier and search() method with the various values for the regex quantifier. The first value shows "-1" output, and the second value shows the position of the characters. Output The output shows the available position start of the input string. ![]() Example 4 The example uses the quantifier and test() method with the various values for the regex quantifier. The first value shows "false" output, and the second regular expression shows "true" output. Output The output shows the Boolean value of the beginning input string. ![]() Example 5 The example uses the quantifier and replace() method with the replaced value for the regex quantifier. We can replace or remove values with a given pattern and new keyword for regular expression. Output The output shows the replaced value of the start characters. ![]() ConclusionThe JavaScript "^" quantifier works with a modifier to get the first input character using regular expression. |
We request you to subscribe our newsletter for upcoming updates.

We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India




