问题描述:

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]`

.