The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Email verification…oh no, not that!

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #184726


    New to JS and am working on verifying email input. I’ve done some searching on the net for a suitable regex to heist, but in the process came across a lot varying opinions and the practicality of using regex for verification. In short, no agreement on a one-solution covers every conceivable situation. That said, what are you using (regex or otherwise) to validate emails?



    Well, if it was important, I wouldn’t be checking if it’s a valid email client-side surely.

    But there’s nothing wrong with using regex in this case, I don’t think JS has a built-in method for it. There may also be libraries that have this as part of their core function.

    Don’t forget that using an HTML5 input type=email will solve the issue in modern browsers anyway.


    a regex that really validates email addresses is quite long, and might not exist anyway.

    As shaneisme noted, client-side validation is nothing but a user convenience anyway, so there’s no point in expending too much energy on it. The more fine-grained you make your check, the more likely you are to end up with false negatives, which is bad UX. Even server-side, the only true test of validity is actually sending an email and getting a response back.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.