Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

RegExp $ quantifier

JavaScript RegExp $ quantifier

RegExp Object Reference The JavaScript RegExp object


Definition and Usage

nThe $ quantifier matches any string ending with n the specified string.

Syntax

new RegExp("

n

$")

or

/

n

$/


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the $ quantifier


Example

Example

Perform a global search for "is" at the end of a string:

var str="Is this his";

var patt1=/is$/g;

The text marked below shows where the expression found matches:

Is this h

is

Try it »


RegExp Object Reference The JavaScript RegExp object