error in module re?

Chris... sca at isogmbh.de
Mon Sep 13 08:22:58 EDT 1999


Dear Pythoners...

  Is this an implementation or documentation error?
>>> import re
>>> re.sub('(a+)\s(b+)', '\2-\1', 'aaa bbb')
'\002-\001'
instead of
'bbb-aaa'
The documentation says, that you can use backreferences in replacement
string, but only \g<number> works.

  My version is:
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32

bye
  Chris...




More information about the Python-list mailing list