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] we
The square brackets create a character class and the hyphen is a shorthand for adding every character between the two provided characters. i.e. [A-F] can be written [ABCDEF].
The character class [A-z] will match every character between those characters, which in ASCII includes some other characters such as '[', '\' and ']'.
An alternative to specifying both cases would be to set the regular expression to be case-insensitive, by using the /i modifier.