diff --git a/collections/string/Validate email b/collections/string/Validate email new file mode 100644 index 00000000..4981103e --- /dev/null +++ b/collections/string/Validate email @@ -0,0 +1,7 @@ +const emailIsValid = (email) => { + return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email); +}; + +// emailIsValid('test@test.com') > true +// emailisValid('test@test') > false +// emailisValid('testtest.pl') > false