Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Update email regex to more accurate one (#10284)
Browse files Browse the repository at this point in the history
  • Loading branch information
CITIZENDOT authored May 31, 2024
1 parent 3b6c801 commit b42fa36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/common/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ Ethereal Engine. All Rights Reserved.
const localBuildOrDev =
globalThis.process.env.APP_ENV === 'development' || globalThis.process.env.VITE_LOCAL_BUILD === 'true'

// https://fightingforalostcause.net/content/misc/2006/compare-email-regex.php
const EMAIL_REGEX =
/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i

export function validateEmail(email: string): boolean {
return /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(email)
return EMAIL_REGEX.test(email)
}

export function validatePhoneNumber(phone: string): boolean {
Expand Down

0 comments on commit b42fa36

Please sign in to comment.