擅长:python、mysql、java
<p>这可以通过导入<code>regex</code>包并使用Unicode类别<code>\p{L}</code>来匹配任何语言的任何类型的字母来实现。撇号、空格、连字符和数字<code>0-9</code>也匹配</p>
<pre><code>import regex
string = "abcd ßloc ådam - + * 1 2 3 ''×Þß÷þø À-ÿ"
pattern = r"[\p{L}\d-' ]+"
result = regex.findall(pattern, string)
print(result)
# OUTPUT
# ['abcd ßloc ådam - ', ' ', " 1 2 3 ''", 'Þß', 'þø À-ÿ']
</code></pre>