当前位置: 动力学知识库 > 问答 > 编程问答 >

regex - \d versus [0-9] in .NET regular expressions

问题描述:

This question already has an answer here:

  • \d is less efficient than [0-9]

    6 answers

网友答案:

I think the answer is also in the linked reference:

\d matches any decimal digit. It is equivalent to the \p{Nd} regular expression pattern, which includes the standard decimal digits 0-9 as well as the decimal digits of a number of other character sets.

So \d can match things like decimal digits in the Arabic character set, which wouldn't be matched with [0-9].

分享给朋友:
您可能感兴趣的文章:
随机阅读: