Re: a more precise re for email addys

2006-01-19 Thread rbt
[EMAIL PROTECTED] wrote: > Does it really need to be a regular expression? Why not just write a > short function that breaks apart the input and validates each part? > > def IsEmail(addr): > 'Returns True if addr appears to be a valid email address' > > # we don't allow stuff like [EMAIL PROT

Re: a more precise re for email addys

2006-01-18 Thread Steven D'Aprano
[EMAIL PROTECTED] wrote: > rbt> re.compile('([EMAIL PROTECTED])') > rbt> re.compile(r'[EMAIL PROTECTED],4}') > rbt> re.compile('(\S+)@(\S+)') > > rbt> All of these will find email addys, but they also find other > rbt> things. > > I think the only way to decide if your regular

Re: a more precise re for email addys

2006-01-18 Thread rbt
[EMAIL PROTECTED] wrote: > Does it really need to be a regular expression? Why not just write a > short function that breaks apart the input and validates each part? > > def IsEmail(addr): > 'Returns True if addr appears to be a valid email address' > > # we don't allow stuff like [EMAIL PROT

Re: a more precise re for email addys

2006-01-18 Thread dave . brueck
Does it really need to be a regular expression? Why not just write a short function that breaks apart the input and validates each part? def IsEmail(addr): 'Returns True if addr appears to be a valid email address' # we don't allow stuff like [EMAIL PROTECTED]@biff.com if addr.count('@') !=

Re: a more precise re for email addys

2006-01-18 Thread rbt
Jim wrote: > There is a precise one in a Perl module, I believe. > http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html > Can you swipe that? > > Jim > I can swipe it... but it causes my head to explode. I get unbalanced paratheses errors when trying to make it work as a python re... it mak

Re: a more precise re for email addys

2006-01-18 Thread André Malo
* rbt wrote: > Is it possible to write an re that _only_ matches email addresses? No. The only way to check if the matched thing is a mail address is to send a mail and ask the supposed receiver whether he got it. The grammar in RFC 2822 nearly matches anything with an @ in it. So, how accurate

Re: a more precise re for email addys

2006-01-18 Thread skip
Jim> http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html Maybe Cafe Express could be convinced to put that on a t-shirt... Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: a more precise re for email addys

2006-01-18 Thread skip
rbt> re.compile('([EMAIL PROTECTED])') rbt> re.compile(r'[EMAIL PROTECTED],4}') rbt> re.compile('(\S+)@(\S+)') rbt> All of these will find email addys, but they also find other rbt> things. I think the only way to decide if your regular expression does what you want is to pro

Re: a more precise re for email addys

2006-01-18 Thread Todd Whiteman
OMG, that is so ugly :D Jim wrote: > There is a precise one in a Perl module, I believe. > http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html > Can you swipe that? > > Jim > > -- http://mail.python.org/mailman/listinfo/python-list

Re: a more precise re for email addys

2006-01-18 Thread Jim
There is a precise one in a Perl module, I believe. http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html Can you swipe that? Jim -- http://mail.python.org/mailman/listinfo/python-list