1const emailRegex = RegExp(
2 /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
3 );
1function validateEmail(email) {
2 const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
3 return re.test(String(email).toLowerCase());
4}
1// Simple and very useful regex. Just Pass your email whare is email here
2const regex = /\S+@\S+\.\S+/
3regex.test(email here)
1
2# Language: Perl
3
4sub Validate_Email($)
5{
6 my $sEmail = $_[0];
7 my $sRetMsg = "";
8
9 my $sUserNmRegex = "^[[:alnum:]]+([.!#\$\%&'*+-\/=?^_'{|]?[[:alnum:]]+)*";
10 my $sDomainRegex = "@[[:alnum:]]+([.-]{1}[[:alnum:]]+)*";
11 my $sEndRegex = "([.]{1}[[:alnum:]]+)+";
12
13 # Work
14 #--------#
15
16 if ($sEmail =~ /$sUserNmRegex$sDomainRegex$sEndRegex$/) {
17 $sRetMsg = "Email is valid";
18 }
19 else {
20 $sRetMsg = "Email is not valid";
21 }
22
23 return $sRetMsg;
24}
25
26my $sEmail = 'EmailExample@gmail.com';
27print "[Email:$sEmail] : " . Validate_Email($sEmail) . "\n";
28
29# OUTPUT -> [Email:EmailExample@gmail.com] : Email is valid
30