Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. import re
  2.  
  3. text = '$mathstuff$ some non-math text with "k" in it $moremkathstuff$ and here some more $mathstuffwithk$'
  4. regex = re.compile(r'\$(?:[^$]*)?(k)(?:[^$]*)?\$')
  5.  
  6. print(re.findall(regex, text))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement