Re:Glibc: [0-9] matches ¼ ١ 2 〣 and others, but not 9 (and o...
by jwilk on Thursday July 19, 2018 @04:48AM
(#17564748)
This is true for many regular expression dialects.
But this bug about POSIX regular expressions. POSIX doesn't define \d, and it defines ranges such as [0-9] only in the POSIX locale.
Historically, glibc considered such ranges in the context of locale's collation order. For example, in Estonian locale, [a-z] doesn't include the letters tuvwxy, because that's how Estonian alphabet works: https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet
This (somewhat surprising) semantics of character ranges is not new, but the recent changes in glibc made it more spectacular.
But this bug about POSIX regular expressions. POSIX doesn't define \d, and it defines ranges such as [0-9] only in the POSIX locale.
Historically, glibc considered such ranges in the context of locale's collation order. For example, in Estonian locale, [a-z] doesn't include the letters tuvwxy, because that's how Estonian alphabet works: https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet
This (somewhat surprising) semantics of character ranges is not new, but the recent changes in glibc made it more spectacular.