Re: Regular Expression for pattern substitution

2005-07-02 Thread James Stroud
You might want to be a little more explicit. Do you know that this = "this" that = "that" or do you mean this = `the part before the \D*` that = `the part after the \D*` If you mean the former, then the previously proposed py> import re py> line = 'see this man with that woman holding this do

Re: Regular Expression for pattern substitution

2005-07-01 Thread Devan L
Hrm, thought it had one. Guess it would help if I actually used regular expression for replacement. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression for pattern substitution

2005-07-01 Thread George Sakkis
"Deval L" wrote: > re.replace. There isn't a re.replace; be careful when you reply to newbies. > "Vibha Tripathi" wrote: > > > 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

Re: Regular Expression for pattern substitution

2005-07-01 Thread Devan L
re.replace. I don't think there's any way to avoid it. Except maybe having an alias email address or a fake one. -- http://mail.python.org/mailman/listinfo/python-list

Regular Expression for pattern substitution

2005-07-01 Thread Vibha Tripathi
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 'tha