Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- text = '$mathstuff$ some non-math text with "k" in it $moremkathstuff$ and here some more $mathstuffwithk$'
- regex = re.compile(r'\$(?:[^$]*)?(k)(?:[^$]*)?\$')
- print(re.findall(regex, text))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement