import re
regex = re.compile(r"^([ \t]*)(.*?(?:[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B).*?)([ \t]*)$", flags=re.MULTILINE)
test_str = ("{\n"
" \"glossary\": {\n"
" \"title\": \"example glossary\",\n"
" cm=\"私は今プログラミングーをしています\"; \n"
" \"text2\": \"example glossary\",\n"
" cm=\"私はABあああをしています\"\n"
"}")
subst = "$1/*$2*/$3"
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html