alternating string replace

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Jan 11 21:42:00 EST 2008


On Fri, 11 Jan 2008 14:55:18 -0600, Reedick, Andrew wrote:

> For those of us who still think in Perl, here's an easy to read 
...
> s = re.sub(r'_(.*?(_|$))', r':\1', s)

"Easy to read"? Oh that's priceless. Andrew, you should consider writing 
comedy professionally!



-- 
Steven



More information about the Python-list mailing list