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

后端 未结 4 1119
死守一世寂寞
死守一世寂寞 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 03:03

    Use a POSIX character class (http://www.regular-expressions.info/posixbrackets.html):

    [-'[:alpha:]0-9] or [-'[:alnum:]]

    The [:alpha:] character class matches whatever is considered "alphabetic characters" in your locale.

提交回复
热议问题