I am using a regex to program an input validator for a text box where I only want alphabetical characters. I was wondering if [A-z] and [a-zA-Z] were equivalent or if there were differences performance wise.
I keep reading [a-zA-Z] on my searches and no mention of [A-z].
I am using java's String.matches(regex).
解决方案
[A-z] will match ASCII characters in the range from A to z, while [a-zA-Z] will match ASCII characters in the range from A to Z and in the range from a to z. At first glance, this might seem equivalent -- however, if you look at this table of ASCII characters, you'll see that A-z includes several other characters. Specifically, they are [, \, ], ^, _, and ` (which you clearly don't want).