checking a string against multiple patterns

kib kib2 at free.fr
Tue Dec 18 07:57:47 EST 2007


tomasz a écrit :

> Is there an alternative to it? Am I missing something? Python doesn't
> have special variables $1, $2 (right?) so you must assign the result
> of a match to a variable, to be able to access the groups.
> 
Hi Thomasz,

See ie :

http://www.regular-expressions.info/python.html [Search and Replace section]

And you'll see that Python supports numbered groups and even named 
groups in regular expressions.

Christophe K.



More information about the Python-list mailing list