JavaScript Regex $ Quantifier

Javascript regular expression uses the "$" quantifier to get an input character at the end of the string. The $ quantifier filters the value at the end of input information using methods. The modifier uses the regexp method and quantifier to operate, replace, search, and match data.

Syntax

The following syntax uses the regex "$" quantifier to get unavailable characters.

Or

Or

Description

  • The global, multiline, and case-insensitive modifiers work with the regex quantifier.
  • The "value" represents the input character at the string's end.

Supported browsers

The given browsers support the javascript regular expression "$" quantifier.

  • Edge
  • Firefox
  • Google Chrome
  • Internet Explorer
  • Opera
  • Safari

Examples

The below examples work with different methods, values, and modifiers using regular expression and $ quantifier in JavaScript.

Example1

The example uses the match() method with different values for the regex quantifier. The first value shows null output, and the second value shows the available value at the end of the string.

Output

The output shows the available characters of the string.

JavaScript Regex $ Quantifier

Example2

The example uses the search() method with the various value regex quantifier values. The first value shows "-1" output, and the second value shows the position of the characters.

Output

The output shows the available position of the input string.

JavaScript Regex $ Quantifier

Example3

The example uses the test() method with the various values for the regex quantifier. The first value shows "false" output, and the second shows "true" output.

Output

The output shows the Boolean value of the input string.

JavaScript Regex $ Quantifier

Example4

The example uses the replace() method with the replaced value for the regex quantifier. We can replace the value with a regex pattern and a new keyword for regular expression.

Output

The output shows the replaced value of the input string.

JavaScript Regex $ Quantifier

Example5

The example uses the search() 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 of the string.

JavaScript Regex $ Quantifier

Example6

The example uses the match() method with different values for the beginning and ending characters of the regex quantifier. It is used to show between values in the string.

Output

The output shows the available characters of the string.

JavaScript Regex $ Quantifier

Example7

The example uses the search() method with the various values for the regex quantifier. We can use the $ quantifier with the + quantifier.

Output

The output shows the available position of the input string.

JavaScript Regex $ Quantifier

Conclusion

The javascript "$" quantifier works with a modifier to get input characters using regular expressions.






Latest Courses