Perl s/ To Python?

2005-06-10 Thread John Abel
Does anyone know of a quick way of performing this: $testVar =~ s#/mail/.*$##g The only way I can think of doing it, is: mailPos = testVar.find( mail ) remainder = testVar[ :mailPos ] Any ideas would be appreciated. I'm iterating over a lot of entries, and running these lines for each

Re: Perl s/ To Python?

2005-06-10 Thread JZ
Dnia Fri, 10 Jun 2005 14:57:21 +0100, John Abel napisa(a): $testVar =~ s#/mail/.*$##g The only way I can think of doing it, is: mailPos = testVar.find( mail ) remainder = testVar[ :mailPos ] Any ideas would be appreciated. I'm iterating over a lot of entries, and running these

Re: Perl s/ To Python?

2005-06-10 Thread John Abel
JZ wrote: Dnia Fri, 10 Jun 2005 14:57:21 +0100, John Abel napisa(a): $testVar =~ s#/mail/.*$##g The only way I can think of doing it, is: mailPos = testVar.find( mail ) remainder = testVar[ :mailPos ] Any ideas would be appreciated. I'm iterating over a lot of entries, and running

Re: Perl s/ To Python?

2005-06-10 Thread Gary Wilson Jr
John Abel wrote: Does anyone know of a quick way of performing this: $testVar =~ s#/mail/.*$##g Use the re (regular expression) module. Since you are iterating over a lot of entries, it is good to compile the regular expression outside of the loop. import re mailRE =

Re: Perl s/ To Python?

2005-06-10 Thread Andreas Kostyrka
I'd consider taking a look at the re module ;) Andreas On Fri, Jun 10, 2005 at 02:57:21PM +0100, John Abel wrote: Does anyone know of a quick way of performing this: $testVar =~ s#/mail/.*$##g The only way I can think of doing it, is: mailPos = testVar.find( mail ) remainder =