DEV Community

Discussion on: Validating email addresses using regular expressions in JavaScript

Collapse
 
ayka_code profile image
ayka.code

While it's true that the <input type="email"> HTML element does provide basic email address validation, it may not be sufficient for all use cases. Using regular expressions (regex) to validate email addresses allows for more precise and customizable validation, as you can specify exactly what constitutes a valid email address according to your specific requirements.

Additionally, the <input type="email"> element only works on modern browsers, whereas regex can be used to validate email addresses on any platform.

That being said, using both the <input type="email"> element and regex can provide an extra layer of validation to ensure that the email addresses entered by users are in the correct format.

Collapse
 
thomasbnt profile image
Thomas Bnt

Good response!

<input type="email"> is good for modern navigators, but not for all. This is important to check in backend and/or on front to check if it is an email with a ReGex. 👍🏼☕