I have the following string: message = 'hi <@ABC> and <@DEF>'
,
And the following Regex: exp = '<@(.*?)>'
, so that re.findall(exp, message)
outputs ['ABC', 'DEF']
. How can I replace the original message matches with those outputs so I get 'hi ABC and DEF'
?
Asked
Active
Viewed 39 times
0
-
Replace with `r'\1'` – Wiktor Stribiżew Jun 04 '19 at 08:58