I want to parse

'[EMAIL PROTECTED]' or '<[EMAIL PROTECTED]>' and get the email address [EMAIL 
PROTECTED]

the regex is

r'<[EMAIL PROTECTED]>|[EMAIL PROTECTED]'

now, I want to give it a name

r'<(?P<email>[EMAIL PROTECTED])>|(?P<email>[EMAIL PROTECTED])'

sre_constants.error: redefinition of group name 'email' as group 2;
was group 1

BUT because I use a | , I will get only one group named 'email' !

Any comment ?

PS: I know the solution for this case is to use  r'(?P<lt><)?(?P<email>
[EMAIL PROTECTED])(?(lt)>)'

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to