Why does character range class [A-z] match underscore?
Character ranges are not that intelligent. They are based on ascii codes. Check out Ascii Table. There exist special characters between upper-case A-Z
and lower-case a-z
range, namely:
[
\
]
^
_
`
So, instead of A-z
it should be A-Za-z
.