With that said, there might be cases when you cannot use those modules and you'd like to implement your own solution using regular expressions.
One of the best (and maybe only valid) use-cases is when you would like to teach regexes.
For example, it accepts [email protected], but shopify does not.If your user enters a bad email address, they won’t get the activation email and they’ll try to register again if they really care about using your site. Enterprising individuals will just copy and paste, but what it comes down to is this: if your user enters a bad email address, you shouldn’t make it more of a problem for yourself than you have to.A complex regex validation on the email address doesn’t introduce an additional solution, it introduces an additional problem.If (like me when I first saw this) you AREN’T experienced at Regex, it takes a while to parse. The local string (the part of the email address that comes before the @) can contain any of these characters: is a valid email address. For this reason, for a time I began running any email address against the following regular expression instead: Simple, right? This is often the most I do and, when paired with a confirmation field for the email address on your registration form, can alleviate most problems with user error.
They can get ridiculously convoluted as in the case above and, according to the specification, are often too strict anyway.
Some servers accept the special characters and handle that based on their own rules.