python正则表达式的Unicode友好字母模式?

时间:2022-06-01 20:02:36

I'm looking for a pattern equivalent to \w, and which doesn't match numeric pattern. I cannot use [a-zA-Z] because I would like it to match japanese kanjis as well.

我正在寻找一个等同于\ w的模式,它与数字模式不匹配。我不能使用[a-zA-Z],因为我希望它能与日本的kanjis相匹配。

Is there a way to write something like [\w^[0-9]] ? Is there an equivalent of [:alpha:] in python regex?

有没有办法写出像[\ w ^ [0-9]]这样的东西?在python正则表达式中是否有[:alpha:]的等价物?

1 个解决方案

#1


11  

[^\W\d]

Throw out non-word characters and throw out digits. Keep the rest.

丢弃非单词字符并丢弃数字。剩下的就是。

#1


11  

[^\W\d]

Throw out non-word characters and throw out digits. Keep the rest.

丢弃非单词字符并丢弃数字。剩下的就是。