reusing parts of a string in RE matches?

John Salerno johnjsal at NOSPAMgmail.com
Thu May 11 17:35:38 CEST 2006


Mirco Wahab wrote:

> I have no idea how to do this
> in Python in a terse way - but
> I'll try ;-)
> 
> In Perl, its easy. Here, the
> "match construct" (\w)(?=(.)\1)
> returns all captures in a
> list (a 1 a 2 a 4 b 7 c 9)

Ah, I see the difference. In Python you get a list of tuples, so there 
seems to be a little extra work to do to get the number out.



More information about the Python-list mailing list