开发者

Regular expression to match ASCII and Unicode letters

Recently I discovered, to my surprise, that JavaScript has no built-in support for Unicode re开发者_运维问答gular expressions.

So how can I test a string for letters only, Unicode or ASCII?


I'd recommend Steven Levithan's excellent XRegExp library, which has a Unicode plugin containing various Unicode character classes: http://xregexp.com/plugins/


Recently I discovered, to my surprise, that javascript has no builtin support for unicode regex.

This comes to a surprise to me as well because

alert(/\u00B6/.test("¶"));

prints true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜