What is a regular expression that accepts only characters ranging from a to z?
Try this to allow both lower and uppercase letters in A-Z:
/^[a-zA-Z]+$/
Remember that not all countries use only the letters A-Z in their alphabet. Whether that is an issue or not for you depends on your needs. You may also want to consider if you wish to allow whitespace (\s
).
Use
^[a-zA-Z]$
and browse for more at Expressions in category: Strings.