参考链接:
- https://stackoverflow.com/questions/2718196/find-all-chinese-text-in-a-string-using-python-and-regex
- https://www.runoob.com/python/python-reg-expressions.html
直接上代码记录一下。
import re
s = 'hello world! 中文'
pattern = re.compile('[\u4e00-\u9fff]+')
result = pattern.search(s)
if result:
index = result.span(0)[0]
print(s[index: len(s)])