how to re.sub() a optional matching group using regex in python?,"re.sub('url((?:#[0-9]+)?)', 'new_url\\1', test2)"