re documentation error

Duncan Booth duncan at
Mon Sep 17 17:44:03 CEST 2001

"Carlos Gaston Alvarez" <cgaston at> wrote in
news:mailman.1000734141.1821.python-list at 

> I am reading the doc at
> and the example is
> the 5.2 (search and replace). I run the example (at last) and the
> results where 
>>>> re.sub('x*', '-', 'abxc') '-a-b--c-' re.sub('x', '-', 'abxc')
> 'ab-c'
> there is an small diference, in doc it said that the first one should
> return 
> '-a-b-d-'
> when it returned
> '-a-b--c-'

That looks like a bug. I just checked and 1.5.2 gives '-a-b-d-' whereas 2.1 
give '-a-b--c-' which as you note is not the advertised behaviour. I 
suggest you post a bug report on sourceforge.

Duncan Booth                                             duncan at
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?

More information about the Python-list mailing list