SyntaxFix
Write A Post
Hire A Developer
Questions
Use re.sub directly, this allows you to specify a count:
re.sub
count
regex.sub('', url, 1)
(Note that the order of arguments is replacement, original not the opposite, as might be suspected.)
replacement
original