Главная страница


ru.cgi.perl

 
 - RU.CGI.PERL ------------------------------------------------------------------
 From : Alexander V. Gaiduk                  2:5020/400     05 Mar 2001  18:30:11
 To : All
 Subject : Re: Проверка на валидность мыла
 -------------------------------------------------------------------------------- 
 
 у меня такое вроде нормально работает:
 
 честно где то украдено :)
 
 ========================
 
 sub checkaddress {
   # yeah, yeah, yeah I know that checking for a valid full RFC-822 e-mail
 address
   # without a parser is a damn pain in the ass.
   # _valid_email tries its best, though.  :)
   # It's gotta be a mailbox.  No groups.  That's redundant.
   # You also have to have a full domain name (and all ultimate top domains
 end in
   # two or three letters) and _valid_email, unlike the rest of the
 validation routines,
   # does not return 1 on success, it returns the e-mail address.  Why's
 that, you ask?
   # That way we can use _valid_email to simultaneously extract out the
   # actual jim3@psynet.net from "Jim Thomason"<jim3@psynet.net>, for
 example.
   #
   #Set No_errors to 1 if you don't trust it.
 
   my ($email) = @_;
   $atom = q<[!#$%&'*+\-/=?^`{|}~\w]>;
   $qstring = q/"(?:[^"\\\\\015]|\\\.)+"/;
   $word = "($atom+|$qstring)";
   $email = _comment_killer($email);
   $email =~ m/^$word\s*\<\s*(.+)\s*\>\s*$/;      #match beginning phrases
   $email = $2 if $2;                             #if we've got a phrase,
 we've extracted
                                                  #the e-mail address
                                                  #and stuck it in $2, so set
 $email to it.
                                                  #if we didn't have a
 phrase, the whole thing
                                                  #is the e-mail address
   return $1
     if $email =~ m<
                    ^\s*($word            # any word (see above)
                    (?:\.$word)*          # optionally followed by a dot,
                                          # and more words, as many times as
 we'd like
                    @                     # and an at symbol
                    $atom+                # followed by as many atoms as we
 want
                    (?:\.$atom+)*         # optionally followed by a dot, and
 more
                                          # atoms, as many times as we'd like
                    \.[a-zA-Z]{2,3})\s*$  # followed by 2 or 3 letters, and
                                          # an optional greater than
                   >xo;
 };
 
 sub _comment_killer {
   my ($email) = shift;
   while ($email =~ /\((?:[^()\\\015]|\\.)*\)/){$email =~
 s/\((?:[^()\\\015]|\\.)*\)//};
   return $email;
 };
 
 ========================
 --- ifmail v.2.15dev5
  * Origin: Demos online service (2:5020/400)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 Проверка на валидность мыла   Stanislav Los   04 Mar 2001 19:33:47 
 Re: Проверка на валидность мыла   Artur Penttinen   05 Mar 2001 09:38:34 
 Re: Проверка на валидность мыла   InSAn   05 Mar 2001 11:34:03 
 Re: Проверка на валидность мыла   Artur Penttinen   05 Mar 2001 14:51:36 
 Re: Проверка на валидность мыла   Artem Chuprina   05 Mar 2001 14:59:43 
 Re: Проверка на валидность мыла   Artur Penttinen   05 Mar 2001 16:10:54 
 Re: Проверка на валидность мыла   Artem Chuprina   05 Mar 2001 17:32:17 
 Re: Проверка на валидность мыла   Artur Penttinen   05 Mar 2001 18:21:59 
 Re: Проверка на валидность мыла   Artem Chuprina   05 Mar 2001 19:15:00 
 Re: Проверка на валидность мыла   Artur Penttinen   05 Mar 2001 20:23:47 
 Re: Проверка на валидность мыла   Artem Chuprina   06 Mar 2001 12:48:02 
 Re: Проверка на валидность мыла   Stanislav Los   06 Mar 2001 15:47:23 
 Re: Проверка на валидность мыла   Artem Chuprina   06 Mar 2001 16:23:56 
 Re: Проверка на валидность мыла   Alexander V. Gaiduk   05 Mar 2001 18:30:11 
 Проверка на валидность мыла   Slava Sidorkov   05 Mar 2001 23:32:44 
 Проверка на валидность мыла   Romic Rookman   08 Mar 2001 13:41:56 
Архивное /ru.cgi.perl/3931e1917eca.html, оценка 1 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional