mystring = """\
I wish this would stick around, but I'm greedy!
"""
greedy = re.compile("()", re.MULTILINE|re.DOTALL)
nongreedy = re.compile("()", re.MULTILINE|re.DOTALL)
# >>> greedy.sub('', mystring)
# '\n\n'
# >>> print nongreedy.sub('', mystring)
# "\n\nI wish this would stick around, but I'm greedy! \n\n"
|