Re: script to match a valid email id
\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b This was taken from: http://www.regexr.com/ 2014-07-10 21:30 GMT+03:00 Sunita Pradhan sunita.pradhan.2...@hotmail.com: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita
Re: script to match a valid email id
On Fri, 11 Jul 2014 10:20:10 +0300 Yosef Levy yosi.lev...@gmail.com wrote: 2014-07-10 21:30 GMT+03:00 Sunita Pradhan sunita.pradhan.2...@hotmail.com: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? \b[\w\.-]+@[\w\.-]+\.\w{2,4}\b This was taken from: http://www.regexr.com/ And is hopelessly naive, and will reject lots of perfectly valid email addresses. For instance, there are lots of new TLDs these days longer than 4 characters - .ninja, .museum, .report, .services, .vision, etc etc etc. It would also match e.g. --a...@--.abcd' and lots of other completely invalid addresses. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: script to match a valid email id
On 2014-07-10 20:30, Sunita Pradhan wrote: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? Almost 10 years ago I posted this: http://www.mail-archive.com/beginners%40perl.org/msg62681.html Probably that function would do for you. You won't easily come up with a valid address that would be rejected. But please note the discussion that followed in that old thread. They thought I ought to use Email::Valid instead. ;-) -- Gunnar Hjalmarsson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
script to match a valid email id
I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita
Re: script to match a valid email id
Sunita Pradhan wrote: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita Take a look at the Email::Valid module. http://search.cpan.org/~rjbs/Email-Valid-1.194/lib/Email/Valid.pm -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: script to match a valid email id
I do not want to use Cpan modules . -Sunita Date: Thu, 10 Jul 2014 11:33:24 -0700 Subject: Re: script to match a valid email id From: r...@i.frys.com To: sunita.pradhan.2...@hotmail.com CC: beginners@perl.org Sunita Pradhan wrote: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita Take a look at the Email::Valid module. http://search.cpan.org/~rjbs/Email-Valid-1.194/lib/Email/Valid.pm -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: script to match a valid email id
On Jul 10, 2014, at 11:30 AM, Sunita Pradhan wrote: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? Sunita, I've used Email::Valid for this and it works nicely. And the code to use it is pretty easy, too. use Email::Valid; if (!Email::Valid-address( -address = $email_address_to_test, -mxcheck = 1 )) { ... process error here ... } https://metacpan.org/pod/Email::Valid Frank http://www.surfshopcart.com/ Setting up shop has never been easier! Now on GitHub https://github.com/surfshopcart/surfshop -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: script to match a valid email id
Then take a look at the Owl (Regular Expressions) book. The first appendix, if I recall correctly) has an regex that will validate an e-mail address. The regex is something over 2,000 characters long. Nota Bene: xxx@zzz.www IS NOT the only valid format for an email address In this case, you really need to rethink your objection to using the proper CPAN module. B On Thu, Jul 10, 2014 at 11:42 AM, Sunita Pradhan sunita.pradhan.2...@hotmail.com wrote: I do not want to use Cpan modules . -Sunita Date: Thu, 10 Jul 2014 11:33:24 -0700 Subject: Re: script to match a valid email id From: r...@i.frys.com To: sunita.pradhan.2...@hotmail.com CC: beginners@perl.org Sunita Pradhan wrote: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita Take a look at the Email::Valid module. http://search.cpan.org/~rjbs/Email-Valid-1.194/lib/Email/Valid.pm -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- Bob Goolsby bob.gool...@gmail.com
Re: script to match a valid email id
On Thu, Jul 10, 2014 at 1:42 PM, Sunita Pradhan sunita.pradhan.2...@hotmail.com wrote: I do not want to use Cpan modules . Depending upon how correct you want to be, it's not easy: http://stackoverflow.com/questions/210945/what-would-be-a-globally-accepted-regular-expression-to-match-e-mail-addresses Mastering Regular Expressiong (O'Reilly - J. Freidl) is a wonderful book and he's got an RE in there that tries to handle the full RFC (5322?) specification but he admits it's not perfect. -- a Andy Bach, afb...@gmail.com 608 658-1890 cell 608 261-5738 wk
Re: script to match a valid email id
use the regular expression for checking @ and dot and length of some address' parts:) for example, try this: #!/usr/bin/perl use warnings; use strict; use 5.014; print enter the email address ; while () { if(/\A.{4,15}\@.+?\..{2,3}\Z/) { print it's correct\n; } else { print it is not correct\n;} } for my email: 4-15 is length of rozanda2014 2-3 is length of ru (may be com) 10.07.2014, 21:31, Sunita Pradhan sunita.pradhan.2...@hotmail.com: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: script to match a valid email id
the r...@i.frys.com address may not be matched by my regexp, because here two dots after @. Here it is more universal: /\A.+?\@.+?\..+\Z/ 10.07.2014, 21:43, Sunita Pradhan sunita.pradhan.2...@hotmail.com: I do not want to use Cpan modules . -Sunita Date: Thu, 10 Jul 2014 11:33:24 -0700 Subject: Re: script to match a valid email id From: r...@i.frys.com To: sunita.pradhan.2...@hotmail.com CC: beginners@perl.org Sunita Pradhan wrote: I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita Take a look at the Email::Valid module. http://search.cpan.org/~rjbs/Email-Valid-1.194/lib/Email/Valid.pm -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
RE: script to match a valid email id
Sunita Pradhan wrote: I do not want to use Cpan modules . -Sunita What do you have against using a cpan module? If you don't want to use the module, then why not simply copy/use the regex that it uses to do the validation? $RFC822PAT = 'EOF'; [\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\ xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xf f\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\x ff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|[^\\\x80-\xff\n\015 ]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[\040\t]*(?:\([^\\\x80-\ xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80 -\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]* )*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\ \\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\ x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x8 0-\xff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|[^\\\x80-\xff\n \015]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([ ^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\ \\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\ x80-\xff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80- \xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015() ]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\ x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\04 0\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\ n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\ 015()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?! [^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\ ]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\ x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\01 5()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)@,;:. \\\[\]\000-\037\x80-\xff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff] )|[^\\\x80-\xff\n\015]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[^ ()@,;:.\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\0 15()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][ ^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|[^\\\x80-\xff\ n\015]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[^()@,;:.\\\[\]\ x80-\xff\000-\010\012-\037]*)*[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(? :(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80- \xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:@[\040\t]* (?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015 ()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015() ]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^(\0 40)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\ [^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\ xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]* )*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80 -\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x 80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t ]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^(\040)@,;:.\\ \[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff]) *\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x 80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80 -\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015( )]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\ \x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*@[\040\t ]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\0 15()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015 ()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^( \040)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]| \\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80 -\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015() ]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^(\040)@,;:. \\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff ])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\ \x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x 80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015
Re: script to match a valid email id
That's a lot of regex. On 7/10/14, 2:25 PM, Ron Bergin wrote: Sunita Pradhan wrote: I do not want to use Cpan modules . -Sunita What do you have against using a cpan module? If you don't want to use the module, then why not simply copy/use the regex that it uses to do the validation? $RFC822PAT = 'EOF'; [\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\ xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xf f\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\x ff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|[^\\\x80-\xff\n\015 ]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[\040\t]*(?:\([^\\\x80-\ xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80 -\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]* )*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\ \\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\ x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x8 0-\xff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|[^\\\x80-\xff\n \015]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([ ^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\ \\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\ x80-\xff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80- \xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015() ]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\ x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\04 0\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\ n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\ 015()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?! [^(\040)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\ ]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\ x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\01 5()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)@,;:. \\\[\]\000-\037\x80-\xff]+(?![^(\040)@,;:.\\\[\]\000-\037\x80-\xff] )|[^\\\x80-\xff\n\015]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[^ ()@,;:.\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\0 15()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][ ^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|[^\\\x80-\xff\ n\015]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015]*)*)[^()@,;:.\\\[\]\ x80-\xff\000-\010\012-\037]*)*[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(? :(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80- \xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:@[\040\t]* (?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015 ()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015() ]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^(\0 40)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\ [^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\ xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]* )*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80 -\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x 80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t ]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^(\040)@,;:.\\ \[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff]) *\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x 80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80 -\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015( )]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\ \x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*@[\040\t ]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\0 15()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015 ()]*)*\)[\040\t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^( \040)@,;:.\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]| \\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80 -\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015() ]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x 80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^ \x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040 \t]*)*(?:[^(\040)@,;:.\\\[\]\000-\037\x80-\xff]+(?![^(\040)@,;:. \\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff ])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\ \x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x 80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015
Re: script to match a valid email id
On Thu, 10 Jul 2014 11:54:07 -0700 Bob goolsby bob.gool...@gmail.com wrote: Nota Bene: xxx@zzz.www IS NOT the only valid format for an email address In this case, you really need to rethink your objection to using the proper CPAN module *This*. Use the well-trusted, battle-tested CPAN module. Whatever you build will likely be sub-par, and will let through invalid email addresses, or, more likely, reject perfectly valid addresses you hadn't thought about. (Not casting any aspersions on your skill level - email validation is notoriously tricky to get right!) Note: you're testing for valid looking - the only way to know for sure if an email address is actually OK is to send an email to it and have them click a link. With all the new TLDs coming out all the time, you can no longer rely on a pre-set list of TLDs which exist - new TLDs (some pointless, some uttterly stupid) are being released all the time, and older email validation code that thinks it knows of all TLDs which exist will reject perfectly valid email addresses. (You can do some checks, for instance, does the domain part resolve with an MX or A record; if not, it's probably not an email address you want to accept. However, even that could trip you up. For example, mickey mouse@[127.0.0.1] is a valid email address :) -- David Precious (bigpresh) dav...@preshweb.co.uk http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedinwww.preshweb.co.uk/facebook www.preshweb.co.uk/cpanwww.preshweb.co.uk/github -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/