Files
calendar/packages/features/ee/organizations/lib/utils.ts
T
Hariom BalharaandGitHub 5886792285 feat: More admin options for organizations (#12424)
* Add more features in org admin

* Pr feedback addressed
2023-12-19 18:31:22 +05:30

9 lines
288 B
TypeScript

export function extractDomainFromEmail(email: string) {
let out = "";
try {
const match = email.match(/^(?:.*?:\/\/)?.*?(?<root>[\w\-]*(?:\.\w{2,}|\.\w{2,}\.\w{2}))(?:[\/?#:]|$)/);
out = (match && match.groups?.root) ?? "";
} catch (ignore) {}
return out.split(".")[0];
}