I'm trying to use python to run regex to do the replacement like below:
a = "%I'm a sentence.|"
re.sub(r"%(.*?)\|", "<\1>", a)
Then b = <\1>
, but I want to get the result of <I'm a sentences.>
How am I supposed to achieve this? I tried to group I'm a sentence
, but I feel I did something wrong, so the result doesn't maintain the group 1.
If you have any ideas, please let me know. Thank you very much in advance!