Hi, I have the following code below:
Found solution with a function: https://docs.python.org/3/library/re.html#text-munging
import re t = '<img data src="some-thing">' pattern = '(<img ).*?(src=")(.*?)(">)' u = re.sub(pattern, '\\1\\2\\3\\4', t) print(u)The output is
<img src="some-thing">
. Is there a way to do some text manipulation on group 3 so it ends up being <img src="something">
? I can't think of a better approach right now. This is a just a basic example of what I am trying to do, the content I am replacing is more complex that just replacing a dash. Thanks.Found solution with a function: https://docs.python.org/3/library/re.html#text-munging