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 be more liberal to check TLDs (#10983)
Browse files Browse the repository at this point in the history
  • Loading branch information
CITIZENDOT authored Aug 16, 2024
1 parent 25bca7b commit 9a578d1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/regex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const USER_ID_REGEX = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-f
* Email regex. Source: https://fightingforalostcause.net/content/misc/2006/compare-email-regex.php
*/
export 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
/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.[a-z]{2,10}|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i

/**
* This regex is useful for validating input that must be exactly 10 digits long, such as a phone number (without any separators or formatting).
Expand Down
1 change: 0 additions & 1 deletion packages/common/tests/regex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ describe('regex.test', () => {
'[email protected].',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]',
Expand Down

0 comments on commit 9a578d1

Please sign in to comment.