Answers for "regex to check valid email"

3

regex to verify email

let regex=/^([a-zA-Z0-9_-.]+)@([a-zA-Z0-9_-.]+).([a-zA-z]+)$/;
Posted by: Guest on May-12-2021
0

regex validate email

# Language: Perl

sub Validate_Email($)
{
   my $sEmail = $_[0];
   my $sRetMsg = "";

   my $sUserNmRegex = "^[[:alnum:]]+([.!#$%&'*+-/=?^_'{|]?[[:alnum:]]+)*";
   my $sDomainRegex = "@[[:alnum:]]+([.-]{1}[[:alnum:]]+)*";
   my $sEndRegex = "([.]{1}[[:alnum:]]+)+";

   #  Work
   #--------#

   if ($sEmail =~ /$sUserNmRegex$sDomainRegex$sEndRegex$/) {
      $sRetMsg = "Email is valid";
   }
   else {
      $sRetMsg = "Email is not valid";
   }

   return $sRetMsg;
}

my $sEmail = '[email protected]';
print "[Email:$sEmail] : " . Validate_Email($sEmail) . "n";

# OUTPUT -> [Email:[email protected]] : Email is valid
Posted by: Guest on April-17-2020

Code answers related to "regex to check valid email"

Code answers related to "Javascript"

Browse Popular Code Answers by Language