Is the regular expression [a-Z] valid and if yes then is it the same as [a-zA-Z]?

No, a (97) is higher than Z (90). [a-Z] isn’t a valid character class. However [A-z] wouldn’t be equivalent either, but for a different reason. It would cover all the letters but would also include the characters between the uppercase and lowercase letters: [\]^_`.

Leave a Comment