The status of a command/function is stored in the bash variable "$? variable so that rather than parsing words as whitespace separated items, bash parses them as dot separated.Putting the value of the subject IP address inside parenthesis and assigning it to itself thereby turns it into an array where each dot separated number is assigned to an array slot.As an additional example, see the "almost RFC 822 compatible regex" in this answer. Keep it simple, and don't mark some e-mail addresses that are actually valid as invalid. Why not have a simple validator that works with 99% of users emails but not make it mandatory that it passes validation?"We see that [email protected] doesn't look like a email address are you sure it's right?At Ventata, we used to have the same issues you've all described with people forgetting things like ".com" and "gmial" vs "gmail".Once we started using mailcheck our bounce rate went way down.
The idea is that most email addresses fall in a very narrow subset of the RFC: [email protected] most people would have entered their email wrong if it didn't match that pattern. From a previous startup we saw a ton of signups like, "[email protected]" and the like.I hear and understand a lot of the comments on this thread mention that regex saves the user from a typo and such.So I want to vouch for a github project called mailcheck by the Kicksend team that's great.Having a-z and A-Z means that both lowercase and uppercase letters are allowed.indicates the minimum and maximum number of characters.
"Some people, when confronted with a problem, think ' I know, I'll use regular expressions.' Now they have two problems."——Jamie Zawinski on regular expressions; paraphrasing the Unix Haters Handbook on As @Simon pointed out, your regular expression might consider some valid addresses as invalid.