[Tutor] re.sub() query

Payal payal-python at scriptkitchen.com
Sun Jun 20 12:12:36 CEST 2010


On Sun, Jun 20, 2010 at 12:03:47PM +0200, Evert Rol wrote:
> >>> re.sub('(?i)l', '-', a)
> 
> See http://docs.python.org/library/re.html#regular-expression-syntax , search for iLmsux, which provide flags inside the regex.
 
Goodness that was fast. Thanks a lot Evert. For records,

>>> re.sub('l(?i)','-',a)
'Mary Had a -itt-e -amb'


With warm regards,
-Payal
-- 


More information about the Tutor mailing list