Não tenho certeza se posso dar a explicação técnica perfeita aqui. talvez alguém possa melhorar a resposta.
Basicamente, lembro que expressões de intervalo são dependentes de localidade, então [a-Z] não significa necessariamente a mesma coisa que [a-zA-Z]
Acho que a documentação relevante é:
link :
Within a bracket expression, a range expression consists of two characters separated by a hyphen. It matches any single character that sorts between the two characters, inclusive, using the locale's collating sequence and character set. For example, in the default C locale, ‘[a-d]’ is equivalent to ‘[abcd]’. Many locales sort characters in dictionary order, and in these locales ‘[a-d]’ is typically not equivalent to ‘[abcd]’; it might be equivalent to ‘[aBbCcDd]’, for example. To obtain the traditional interpretation of bracket expressions, you can use the ‘C’ locale by setting the LC_ALL environment variable to the value ‘C’.