0

Is it possible to do a replacement with a wildcard and use the values of the wildcard in Python?

A simplified problem might look like this:

import re
txt = "Some text of SpaFrancein"
tx = re.sub("Spa.*in",'Spain and .*',txt)

>>> tx
'Some text of Spain and .*'

However, I would like to have 'Some text of Spain and France'

0 Answers0