Skip to content

Instantly share code, notes, and snippets.

@kozo496
Created June 4, 2022 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kozo496/d7a44b2887854c8a790ba359837d79fc to your computer and use it in GitHub Desktop.
Save kozo496/d7a44b2887854c8a790ba359837d79fc to your computer and use it in GitHub Desktop.
Python - re.subでタグを変換
import re
# `text`中のlatexのタグ`$`を`[tex:]`変更
result = re.sub(r'\$(\S+?)\$', r'[tex: \1]', text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment