# JavaScript Challenge: Validating Email Addresses

**URL:** <https://forum.devtalk.com/t/javascript-challenge-validating-email-addresses/127413>\
**Category:** General Questions/Help\
**Tags:** js\
**Created:** [6 October 2023 07:33 UTC](https://forum.devtalk.com/t/javascript-challenge-validating-email-addresses/127413 "2023-10-06T07:33:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mindriot](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mindriot/32/6660_2.png) [@mindriot](https://forum.devtalk.com/u/mindriot)\
**Post date:** [9 October 2023 16:37 UTC](https://forum.devtalk.com/t/javascript-challenge-validating-email-addresses/127413/3 "2023-10-09T16:37:25Z")

</div>

According to the [docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation), browsers use an algorithm equivalent to this regex for email input types:

```auto
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;

```

So that could be a reasonably good baseline generally especially if you want to use those inputs at some point. However this does only check that the email address is of a valid format rather than necessarily meaning it is actually a valid email address, for that you likely need to go down the route of sending a validation link to the email address. It is also worth keeping in mind that if you are only doing this check in the client side then it will still be possible for someone to send messed up data directly to the server.

---

_[View the full topic](https://forum.devtalk.com/t/javascript-challenge-validating-email-addresses/127413)._
