Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从字符串中删除所有非字母和标记(Unicode 类别)字符。目前我正在拆分并随后加入一个字符串,如下所示:
text.split("[\\p{P} \\t\\n\\r]")
然而,我的正则表达式......严重不足。请帮忙。
编辑 我认为这会起作用:
text.split("[\\P{M}\\P{L}]")
试试这个:
text = text.replaceAll("[^\\p{L}\\p{M}]", "");
在http://www.regular-expressions.info/unicode.html中查看更多信息