Use regex to check for email on RegisterPage

This commit is contained in:
thecashewtrader
2022-11-28 20:36:02 +05:30
parent 74c0795248
commit 66913818b4
2 changed files with 11 additions and 1 deletions

8
src/utils/Misc.js Normal file
View File

@@ -0,0 +1,8 @@
export const isEmail = input => {
// Taken from https://emailregex.com
const result = input.match(
//eslint-disable-next-line
/^(([^<>()\[\]\\.,;:\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,}))$/,
);
return result;
};