Regular Expression for pattern substitution
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Regular Expression for pattern substitution

From: Vibha Tripathi <vibtrip@yahoo.com>
Date: Fri Jul 01 2005 - 18:39:33 CEST

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
Received on Thu Sep 29 16:41:42 2005