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

RegExp . metacharacter

JavaScript RegExp . metacharacter

RegExp Object Reference JavaScript RegExp Object


Definition and Usage

The . metacharacter is used to find a single character, except for newline and line terminators.

Syntax

new RegExp("

regexp

.")

Or a simpler way:

/

regexp

./


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the . metacharacter


Example

Example

Perform a global search for "h.t" in the string:

var str="That's hot!";

var patt1=/h.t/g;

The text marked below shows where the expression found matches.

T

hat

's

hot

!

Try it »


RegExp Object Reference JavaScript RegExp Object