I searched existing questions but they do not seem to answer this specific question.
I have the following python program
description = """\
before
{cs:id=841398|rep=myrepo}: after
"""
pattern = re.compile(r"(.*)\{cs:id=(.*)\|rep=(.*)\}(.*)")
and I need to replace the regex in the description to look like the below but I can't get the pattern and replacement syntax right
description="""\
before
<a href="http://crucible.app.com:9090/myrepo?cs=841398">841398</a> : after
"""
The crucible.app.com:9090 is a constant that I have beforehand so I basically need to substitute the pattern with my replacement.
Can someone show me what is the best python regex find and replace syntax for this?
re.sub?