I\'m searching a file line by line for the occurrence of ##random_string##. It works except for the case of multiple #...
pattern=\'##(.*?)##\' prog=re.compile(p
>>> import re >>> text= 'lala ###hey## there' >>> matcher= re.compile(r"##[^#]+##") >>> print matcher.sub("FOUND", text) lala #FOUND there >>>