fork download
  1. import re
  2. a = '*my italic text*'
  3. b = '**NOT italic**'
  4. x = re.sub(r'[*](?!\*)([^\*]+)[*](?!\*)', r'<em>\1</em>', a)
  5. y = re.sub(r'[*](?!\*)([^\*]+)[*](?!\*)', r'<em>\1</em>', b)
  6. print(x, y)
Success #stdin #stdout 0.11s 10104KB
stdin
Standard input is empty
stdout
<em>my italic text</em> **NOT italic**