[Tutor] regex advise + email validate

Norman Khine norman at khine.net
Fri Oct 1 14:27:12 CEST 2010


thanks for the links, i was just looking at the regular-expressions.info site.


On Fri, Oct 1, 2010 at 2:07 PM, Christian Witts <cwitts at compuscan.co.za> wrote:
> On 01/10/2010 13:34, Norman Khine wrote:
>>
>> hello, i have this code
>>
>> http://pastie.org/1193091
>>
>> i would like to extend this so that it validates TLD's such as .travel
>> and .museum, i can do this by changing {2,4} to {2,7} but this sort of
>> defeats the purpose of validating the correct email address.
>>
>> are there any python libraries available to use for this?
>>
>> thanks
>>
>>
>
> Well you could look at the implementation of RFC 2822 [1] on
> regular-expressions.info [2] and use the more practical implementation under
> the "The Official Standard: RFC 2822" section.
>
> For python packages you can look at fv_email [3].
>
> [1] http://tools.ietf.org/html/rfc2822#section-3.4.1
> [2] http://www.regular-expressions.info/email.html
> [3] http://pypi.python.org/pypi/fv_email/0.9
>
> --
> Kind Regards,
> Christian Witts
>
>
>



-- 
˙uʍop ǝpısdn p,uɹnʇ pןɹoʍ ǝɥʇ ǝǝs noʎ 'ʇuǝɯɐן sǝɯıʇ ǝɥʇ puɐ 'ʇuǝʇuoɔ
ǝq s,ʇǝן ʇǝʎ
%>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )


More information about the Tutor mailing list