\d只匹配0-9位数? [英] \d only matchs 0-9 digits?
本文介绍了\d只匹配0-9位数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
据我所知, \d
应匹配非英文数字,例如 1234567890
但它在JavaScript中无法正常工作。
As far as I know, \d
should matchs non-english digits, e.g. ۱۲۳۴۵۶۷۸۹۰
but it doesn't work properly in JavaScript.
请参阅此jsFiddle: http://jsfiddle.net/xZpam/
See this jsFiddle: http://jsfiddle.net/xZpam/
这是正常行为吗?
推荐答案
JavaScript不支持Unicode正则表达式匹配(并且它远不是唯一真正存在的语言)。
JavaScript does not support Unicode regex matching (and it is far from the only language where such is true).
http://www.regular-expressions.info/unicode.html
这篇关于\d只匹配0-9位数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文