Skip to content

Instantly share code, notes, and snippets.

@htlin222
Last active November 9, 2022 12:07
Show Gist options
  • Save htlin222/6ec7da1694776ebb2a816a0937de6049 to your computer and use it in GitHub Desktop.
Save htlin222/6ec7da1694776ebb2a816a0937de6049 to your computer and use it in GitHub Desktop.
import os
import re
import pyperclip as pc
# pip install pyperclip if not installed
text = pc.paste()
# replace:
# 「blablabla... 」
#
# 摘錄自:Author. 「」。Apple Books.
#
# To:
# blablabla...
result = re.sub('(\u300c)(.*)(\u300d\n\n\u6458\u9304\u81ea.*Apple\sBooks\.)','\g<2>',text)
print(result)
@htlin222
Copy link
Author

htlin222 commented Nov 9, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment