Checking for diacritics with a regular expression

前端 未结 1 1054
星月不相逢
星月不相逢 2020-12-03 21:18

Simple problem: an existing project allows me to add additional fields (with additional checks on those fields as regular expressions) to support custom input forms. And I

相关标签:
1条回答
  • 2020-12-03 21:42

    You can use the specific Unicode escape for letters - \p{L} (this will include the A-Za-z ranges):

    ^[.\p{L}]*$
    

    See on regularexpressions.info:

    \p{L} or \p{Letter}

    Matches a single Unicode code point that has the property "letter". See Unicode Character Properties in the tutorial for a complete list of properties. Each Unicode code point has exactly one property. Can be used inside character classes.

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