Re: re.sub() problem (regular expression)

2007-12-13 Thread Rick Dooling
On Dec 13, 9:00 pm, Davy <[EMAIL PROTECTED]> wrote: > > What's "\1" and the whole re.sub() mean? > Read about backreferences here: http://www.regular-expressions.info/brackets.html Also see the entry on parentheses here: http://docs.python.org/lib/re-syntax.html rick -- http://mail.python.or

re.sub() problem (regular expression)

2007-12-13 Thread Davy
Hi all, I have read a re.sub() that confused me. s = 'P & Q' s = re.sub(r'([a-zA-Z0-9_.]+)', r'Expr("\1")', s) What's "\1" and the whole re.sub() mean? Best regards, Davy -- http://mail.python.org/mailman/listinfo/python-list