简体   繁体   中英

How can I convert these ASCI codes to Unicode?

jslint appears to complain here:

Unexpected '\' before 'X'.
    Priv.SELECTOR = /^(@|#|\.)([\x20-\x7e]+)$/;

Perhaps if I used Unicode things would work?

It seems that \\uXXXX notation is recognized by jslint as valid. Use

Priv.SELECTOR = /^([@#.])([\u0020-\u007e]+)$/;

or

Priv.SELECTOR = new RegExp("^([@#.])([\\u0020-\\u007e]+)$");

Note that the backslashes must be doubled inside a RegExp constructor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM