What's a good regex to include accented characters in a simple way?

后端 未结 4 1111
死守一世寂寞
死守一世寂寞 2020-12-14 02:12

Right now my regex is something like this:

[a-zA-Z0-9] but it does not include accented characters like I would want to. I would also like - \' , to be included.

4条回答
  •  自闭症患者
    2020-12-14 02:57

    You just put:

    \p(L}\p{M}
    

    in your expression. This in Unicode will match:

    • any letter character (L) from any language
    • and marks (M)(i.e, a character that is to be combined with another: accent, etc.)

提交回复
热议问题