E
Emanuele D'Arrigo
Hi everybody,
I'm having a ball with the power of regular expression but I stumbled
on something I don't quite understand:
theOriginalString = "spam
?P<first>.*) ham
?P<second>.*)"
aReplacementPattern = "\(\?P<first>.*\)"
aReplacementString= "foo"
re.sub(aReplacementPattern , aReplacementString, theOriginalString)
results in :
"spam:foo"
instead, I was expecting:
"spam:foo ham:"
Why is that?
Thanks for your help!
Manu
I'm having a ball with the power of regular expression but I stumbled
on something I don't quite understand:
theOriginalString = "spam
aReplacementPattern = "\(\?P<first>.*\)"
aReplacementString= "foo"
re.sub(aReplacementPattern , aReplacementString, theOriginalString)
results in :
"spam:foo"
instead, I was expecting:
"spam:foo ham:"
Why is that?
Thanks for your help!
Manu