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

后端 未结 8 1380
北荒
北荒 2021-01-05 12:16

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

相关标签:
8条回答
  • 2021-01-05 13:10

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

    0 讨论(0)
  • 2021-01-05 13:11

    Use

    ^[a-zA-Z]$
    

    and browse for more at Expressions in category: Strings.

    0 讨论(0)
提交回复
热议问题