The only reason that [[:digit:]]must be used is to support locales that use digits other than 0-9. For example Arabic-Indic Numerals: ٠١٢٣٤٥٦٧٨٩ (Unicode U+0660 through U+0669). Otherwise for the Hindu-Arabic numerals 0123456789, [0-9] works equally as well as [[:digit:]].
# time grep -oE '[[:digit:]]' /etc/services
...
real 0m0.029s
user 0m0.017s
sys 0m0.013s
# time grep -oE '[0-9]' /etc/services
...
real 0m0.029s
user 0m0.016s
sys 0m0.012s
I could probably write a quick script to average them, and I bet I'd find that the averages are identical, but it certainly gives you the idea.
The only reason that
[[:digit:]]
must be used is to support locales that use digits other than0-9
. For example Arabic-Indic Numerals:٠١٢٣٤٥٦٧٨٩
(Unicode U+0660 through U+0669). Otherwise for the Hindu-Arabic numerals0123456789
,[0-9]
works equally as well as[[:digit:]]
.I could probably write a quick script to average them, and I bet I'd find that the averages are identical, but it certainly gives you the idea.