Regex matching first capital letter followed by one or more small letters

前端 未结 2 2002
暗喜
暗喜 2021-01-26 09:32

That is my regular expression:

[A-Ö]{1}[a-ö]

When I write that everything is fine until I write another small letter it doesn\'t work. E.g.

2条回答
  •  醉梦人生
    2021-01-26 10:11

    Note that [A-Ö] matches all lower and uppercase letters and a lot of other symbols, too.

    You need

    [A-ZÖ][a-zö]+
    

    See regex demo

    Note that + matches 1 or more occurrences of the preceding subpattern.

提交回复
热议问题