Let't check mail address simply using Perl regular expression.
if ($mail =~ /^.+\@.+$/a) {
}
This means $mail is
[one more ASCII]@[one more ASCII]
Improvement
ASCII graphic characters are a little better.
/^\p{PosixGraph}+\@\p{PosixGraph}+$/
Oldest comments (7)
I prefer the Email::Valid module. And Email::Valid::Loose which used to be very handy with older phone email addresses provided in japan.
Thank you for information.
How far down the regex rabbit hole do you want to go?
Must start with a letter/number
Can have one period before the @
Can't have more than one period
Cannot have spaces
Must be at least one letter/number between period and @
Must be at least one letter/number immediately after @
Must be a period after @
Must be at least two characters after the period
Can be a second period after the min 2 chars if they are co
Must be 2 chars after the the second period
They must match a list of country codes.
Thank you for your information.
"hello world.."@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0000:7324]
.Oh, this is valid in my regex.
ASCII graphic characters are a little better. Spaces are not good.