From 5866adfa5e42d5bf0ca2d6aba138d8937c11dbdb Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 26 Dec 2023 18:58:29 +0530 Subject: [PATCH] fix: added validate email function in utils --- frontend/src/utils/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js index c66cf564..61518b60 100644 --- a/frontend/src/utils/index.js +++ b/frontend/src/utils/index.js @@ -106,3 +106,9 @@ export function formatNumberIntoCurrency(value) { export function startCase(str) { return str.charAt(0).toUpperCase() + str.slice(1) } + +export function validateEmail(email) { + let regExp = + /^(([^<>()[\]\\.,;:\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 regExp.test(email) +}