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
Adding + to regex, which means to match one or more character.
pattern='#+(.*?)#+' prog=re.compile(pattern) string='###HEY##' result=prog.search(string) print result.group(1)
Output:
HEY