Regex to match only letters

后端 未结 20 1802
孤城傲影
孤城傲影 2020-11-22 16:24

How can I write a regex that matches only letters?

20条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 16:35

    The closest option available is

    [\u\l]+
    

    which matches a sequence of uppercase and lowercase letters. However, it is not supported by all editors/languages, so it is probably safer to use

    [a-zA-Z]+
    

    as other users suggest

提交回复
热议问题