We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d13dca commit 4f1ae51Copy full SHA for 4f1ae51
1 file changed
01 - JavaScript-Basics/emailValidate.js
@@ -0,0 +1,8 @@
1
+function validateEmail(email) {
2
+ const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
3
+ return re.test(String(email).toLowerCase());
4
+}
5
+
6
+console.log(validateEmail('example@example.com')); // true
7
+console.log(validateEmail('example12121@gmail.com')); // true
8
+console.log(validateEmail('example121.gmail.com')); // false
0 commit comments