"Get" == Get Links <
[email protected]> writes:
Get> if ($email
Get> =~m/^([A-Z0-9]+[._]?){1,}[A-Z0-9]+\@(([A-Z0-9]+[-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i)
That's absolutely *not* a regex to match a "valid email address".
You are victim of the cargo-cult phenomenon of "cut n paste this from
somewhere else" which apparently *also* got it wrong.
To validate email addresses, see Email::Valid and Mail::RFC822::Address
in the CPAN. Both of them *compute* the "valid email regex" from
component rules. Here is the result of one of them:
$ perl -MMail::RFC822::Address -le 'print Mail::RFC822::Address::make_rfc822re()'
(?

?:\r\n)?[ \t])*(?

?

?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*))*@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)*\<(?

?:\r\n)?[ \t])*(?

(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*(?:,@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*)*

?

?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*))*@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*\>(?

?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)*

?

?:\r\n)?[ \t])*(?

?

?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*))*@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)*\<(?

?:\r\n)?[ \t])*(?

(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*(?:,@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*)*

?

?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*))*@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*\>(?

?:\r\n)?[ \t])*)(?:,\s*(?

?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*))*@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)*\<(?

?:\r\n)?[ \t])*(?

(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*(?:,@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*)*

?

?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?

?:\r\n)?[ \t]))*"(?

?:\r\n)?[ \t])*))*@(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*)(?:\.(?

?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?

?

?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?

?:\r\n)?[ \t])*))*\>(?

?:\r\n)?[ \t])*))*)?;\s*)
Yes, if you're not using a regex that is at LEAST that complex, you are NOT
matching email addresses. Yes, I'm serious.
print "Just another Perl hacker,"; # the original