regexp substitution - a lot of work!
me at privacy.net
Thu Jun 17 10:44:37 CEST 2004
Lukas Holcik <xholcik1 at fi.muni.cz> wrote in
news:Pine.LNX.4.60.0406161824510.15043 at nymfe30.fi.muni.cz:
> Yes, sorry, I was in such a hurry I didn't found it in the
> documentation, but when I want to use a lot of very different
> expressions using a lot of different grouping, which would be easy to
> implement using s/(..)/x\1x/ then it is quite problematic having to
> use re.sub(), isn't it?
I don't understand your point. The Python equivalent is:
re.sub('(..)', r'x\1x', s)
or using a precompiled pattern:
More information about the Python-list