Latest web development tutorials

RegExp $ quantifier

RegExp Object Reference JavaSript RegExp objects

Definition and Usage

n$ quantifier matches any string withnend.

grammar

new RegExp("n$")

或者

/n$/


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support $ quantifier


Examples

Examples

On the end of the string "is" a global search ::

var str="Is this his";
var patt1=/is$/g;

Surface marked text shows where the expression gets a match:

Is this h is

try it"


RegExp Object Reference JavaSript RegExp objects