Regular expression problem with groups

Axel Kowald kowald at
Mon Aug 16 17:08:15 CEST 2004

Hi everybody,

I have a 'simple' problem with regular expressions. Maybe someone can
help me.

import re
bla = 'the the'
obj ='(.+) \1',bla) should now be 'the'. Instead obj is none (python 2.3
under windows and 2.1 under linux). The problem seems to be the \1
where I try to reference the first group. However, every tutorial says
this is the correct way to do it !?

Any ideas what I'm doing wrong ?

Many thanks,

More information about the Python-list mailing list