Alex Rivera | Logout

Regular expression to accept only characters (a-z) in a textbox

Asked 2010-11-22T09:49:40.700
11

What is a regular expression that accepts only characters ranging from a to z?

Edit
Report

1 Answer

13

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).

answered 2010-11-22T09:51:22.970

Your Answer