Latest web development tutorials

RegExp. Metacharacter

RegExp Object Reference JavaScript RegExp Object

Definition and Usage

The meta character used to find a single character, except newline and line endings.

grammar

new RegExp("regexp.")

或者更简单方式:

/regexp./


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support. Metacharacter


Examples

Examples

For string "ht" global search:

var str="That's hot!";
var patt1=/h.t/g;

The marked text below shows where the expression gets a match

T hat 's hot !

try it"


RegExp Object Reference JavaScript RegExp Object