Regex replace (in Python) - a more simple way?
Posted
by Evan Fosmark
on Stack Overflow
See other posts from Stack Overflow
or by Evan Fosmark
Published on 2009-01-29T05:43:24Z
Indexed on
2010/03/17
23:11 UTC
Read the original article
Hit count: 270
Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like:
"(?P<start>some_pattern)(?P<replace>foo)(?P<end>end)"
And then concatenate the start
group with the new data for replace
and then the end
group.
Is there a better method for this?
© Stack Overflow or respective owner