fork download
  1. import re
  2.  
  3. text = r'$\$x + \$y = 5$ and $3$'
  4. print re.findall(r'(?<=\$)([^$\\]*(?:\\.[^$\\]*)*)(?=\$)', text)
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
['\\$x + \\$y = 5', ' and ', '3']