Latest

recent

JavaScript RegExp.dot(.) Modifier

Definition and Usage

When the . modifier is set the regular expression matches the . character to all characters except newline or other line terminators.

Syntax

new RegExp("regexp.")
OR
/regexp./

Parameter Description
regexp Required. The rest of the regular expression to use


Example

In the following code we will do a global search for "h.t" (will find "hat"):

var str = "That's that!";
var patt1 = new RegExp("h.t","g");

The marked text below shows where the RegExp gets a match:

That's that!
JavaScript RegExp.dot(.) Modifier Reviewed by 1000sourcecodes on 21:58 Rating: 5
Powered by Blogger.