re
matches are eager so they try to match as much text as possible, for the simple test case you mention just let the regex run:
>>> re.sub(r'\(.*\)', '', 'stuff(remove(me))')'stuff'
re
matches are eager so they try to match as much text as possible, for the simple test case you mention just let the regex run:
>>> re.sub(r'\(.*\)', '', 'stuff(remove(me))')'stuff'