JavaScript RegExp \uxxxxMetacharacter

RegExp 对象参考手册JavaScript RegExp Object

Definition and Usage

The \uxxxx metacharacter is used to find, by a hexadecimal number,xxxxthe specified Unicode character.

If no match is found, null is returned.

Syntax

new RegExp("\uxxxx")

Or a simpler way:

/\uxxxx/


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the \uxxxx metacharacter.


Example

Example

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

var str="Visit W3Schools. Hello World!";
var patt1=/\u0057/g;

Below,the markedtext shows where the expression obtained a match:

Visit W3Schools. Hello World!

Try it yourself »


RegExp 对象参考手册JavaScript RegExp Object Other Extensions