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

RegExp \uxxxx metacharacter

JavaScript RegExp \uxxxx metacharacter

RegExp Object Reference JavaScript RegExp Object


Definition and Usage

The \uxxxx metacharacter is used to find a character specified by a hexadecimal number xxxx (the specified Unicode character).

If no match is found, null is returned.

Syntax

new RegExp("\u

xxxx

")

Or a simpler way:

/\u

xxxx

/


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the \uxxxx metacharacter


Example

Example

Perform a global search for hexadecimal 0057 (W) in the string:

var str="Visit W3Schools. Hello World!";

var patt1=/\u0057/g;

The text marked below shows where the expression found matches:

Visit

W

3Schools. Hello

W

orld!

Try it »


RegExp Object Reference JavaScript RegExp Object