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




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to