[boston-pig] Python syntax question

Brook, Robert Robert.Brook at ElectricInsurance.com
Tue Jun 5 06:43:40 MDT 2007


Thank you everyone.
 
Everyone has provided me with the same answer and it works very nicely.
 
 

-----Original Message-----
From: Chris Curvey [mailto:ccurvey at gmail.com]
Sent: Tuesday, June 05, 2007 8:03 AM
To: Brook, Robert
Cc: boston-pig at wingware.com
Subject: Re: [boston-pig] Python syntax question


nope, but you can do it with the "re" module..

import re

compiled_regexp = re.compile("sensitive", re.IGNORECASE)

print re.sub(compiled_regexp, "foobar", "I'm INSENSITIVE") 

(should replace any flavor of "sensitive" with "foobar" -- in this case,
returning "I'm INfoobar")


On 6/5/07, Brook, Robert < Robert.Brook at electricinsurance.com
<mailto:Robert.Brook at electricinsurance.com> > wrote: 

 

Does anyone know if there is a parameter I can set on the replace function
that will do a case insensitive replace (old,new).
 
 
Thanks in advance.
 
 


	Robert Brook
Electric Insurance Company
75 Sam Fonzo Drive, Beverly, MA 01915
phone: 978.524.5374
fax: 978.236.5374
robert.brook at electricinsurance.com
<mailto:robert.brook at electricinsurance.com> 
http://www.electricinsurance.com <http://www.electricinsurance.com/>  

 



_______________________________________________
boston-pig mailing list
boston-pig at wingware.com <mailto:boston-pig at wingware.com> 
http://wingware.com/mailman/listinfo/boston-pig
<http://wingware.com/mailman/listinfo/boston-pig> 






-- 
I am often wrong, but I am never in doubt. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/boston-pig/attachments/20070605/95b5b725/attachment-0001.html


More information about the boston-pig mailing list