I have the following piece of code:
import res = "Example {String}"replaced = re.sub('{.*?}', 'a', s)print replaced
Which prints:
Example a
Is there a way to modify the regex so that it prints:
Example {a}
That is I would like to replace only the .* part and keep all the surrounding characters. However, I need the surrounding characters to define my regex. Is this possible?