Regular Expression for pattern substitution

Vibha Tripathi vibtrip at yahoo.com
Fri Jul 1 18:39:33 CEST 2005


It'd be silly to write the code for it if it already
exists somewhere in the Python re or sre library
module:

I need to find and replace all strings in a text file
from a certain pattern to another pattern.

so for example if I see 'this(\D*)that' anywhere in
the file then I'd like to make is 'that(\D*)this'
where the middle part of the strings remains
unmodified.

Any suggestions?

Peace.
Vibha

PS. How do I avoid getting my email ID web-published
for this mailing list.?


		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com



More information about the Python-list mailing list