We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5f18f73 + 4f288af commit 4746097Copy full SHA for 4746097
src/utils/regex.util.js
@@ -11,4 +11,14 @@ export const buildLookaheadRegex = (tokens = []) => {
11
const lookahead = tokens.map(t => `(?=.*\\b${t}\\b)`).join("");
12
// keep it anchored (start) to reduce backtracking
13
return new RegExp(`^${lookahead}.*$`, "i");
14
-};
+};
15
+
16
+/**
17
+ * Basic email validation (practical, not full RFC5322).
18
+ * Returns true for common valid emails like "user@example.com".
19
+ * Note: prefer sending a confirmation email for final verification.
20
+ */
21
+export const isEmail = (s = '') => {
22
+ const re = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;
23
+ return re.test(String(s).trim());
24
0 commit comments