JavaScript RegExp $Quantifier

RegExp 对象参考手册JavaScript RegExp Object

Definition and Usage

nThe $ quantifier matches any string ending withnthe 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;

FaceMarkedtext shows where the expression gets a match:

Is this his

Try it yourself »


RegExp 对象参考手册JavaScript RegExp Object Other Extensions