mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
0e782d3fb6
* [Settings] "Start by adding your email address" hint GitOrigin-RevId: 19d432c70b173752ee7c6d8978dd6be16b042921
12 lines
536 B
TypeScript
12 lines
536 B
TypeScript
// Copied from backend code: https://github.com/overleaf/internal/blob/6af8ae850bd8075e6bf0ebcafd2731177cdf49ad/services/web/app/src/Features/Helpers/EmailHelper.js#L4
|
|
const EMAIL_REGEXP =
|
|
// eslint-disable-next-line no-useless-escape
|
|
/^([^<>()[\]\\.,;:\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,}))$/
|
|
|
|
export function isValidEmail(email: string | undefined | null) {
|
|
if (!email) {
|
|
return false
|
|
} else {
|
|
return EMAIL_REGEXP.test(email)
|
|
}
|
|
}
|