Skip to content

isEmail feature #2524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AkaeyesWanabe opened this issue Feb 3, 2025 · 6 comments
Open

isEmail feature #2524

AkaeyesWanabe opened this issue Feb 3, 2025 · 6 comments
Labels

Comments

@AkaeyesWanabe
Copy link

Results-of-ValidatorJS.pdf

There is a problem in validation of some email addresses

You can see the joined document. it's a test of your isEmail validation script.

@WikiRik
Copy link
Member

WikiRik commented Feb 3, 2025

Could you share the text contents of the PDF in this file? Or as image?
Due to security concerns I'd rather not open random PDFs

@AkaeyesWanabe
Copy link
Author

AkaeyesWanabe commented Feb 4, 2025

OK i see. Sorry for the late.

Image
Image
Image
Image

@AkaeyesWanabe
Copy link
Author

this is emails addresses list (You can try yourself):

-- invalid addresses from Wikipedia resource
invalid
#, 011, ASCII@ASCII.ASCII, new-long, Long ASCII
abc.example.com
#, 012, ASCII@ASCII.ASCII, new-long, Long ASCII
a@b@c@example.com
#, 013, ASCII@ASCII.ASCII, new-long, Long ASCII
a"b(c)d,e:f;gi[j\k]l@example.com
#, 014, ASCII@ASCII.ASCII, new-long, Long ASCII
just"not"right@example.com
#, 015, ASCII@ASCII.ASCII, new-long, Long ASCII
this is"not\allowed@example.com
#, 016, ASCII@ASCII.ASCII, new-long, Long ASCII
this\ still"not\allowed@example.com
#, 017, ASCII@ASCII.ASCII, new-long, Long ASCII
1234567890123456789012345678901234567890123456789012345678901234+x@example.com
#, 018, ASCII@ASCII.ASCII, new-long, Long ASCII
i.like.underscores@but_they_are_not_allowed_in_this_part

-- valid addresses from Wikipedia resource
valid
#, 200, ASCII@ASCII.ASCII, new-long, Long ASCII
x@example.com
#, 201, ASCII@ASCII.ASCII, new-long, Long ASCII
x@example.com
#, 202, ASCII@ASCII.ASCII, new-long, Long ASCII
long.email-address-with-hyphens@and.subdomains.example.com
#, 203, ASCII@ASCII.ASCII, new-long, Long ASCII
user.name+tag+sorting@example.com
#, 204, ASCII@ASCII.ASCII, new-long, Long ASCII
name/surname@example.com
#, 205, ASCII@ASCII.ASCII, new-long, Long ASCII
admin@example
#, 206, ASCII@ASCII.ASCII, new-long, Long ASCII
example@s.example
#, 207, ASCII@ASCII.ASCII, new-long, Long ASCII
" "@example.org
#, 208, ASCII@ASCII.ASCII, new-long, Long ASCII
"john..doe"@example.org
#, 209, ASCII@ASCII.ASCII, new-long, Long ASCII
mailhost!username@example.org
#, 210, ASCII@ASCII.ASCII, new-long, Long ASCII
"very.(),:;<>[]".VERY."very@\ "very".unusual"@strange.example.com
#, 211, ASCII@ASCII.ASCII, new-long, Long ASCII
user%example.com@example.org
#, 212, ASCII@ASCII.ASCII, new-long, Long ASCII
user-@example.org
#, 213, ASCII@ASCII.ASCII, new-long, Long ASCII
postmaster@[123.123.123.123]
#, 214, ASCII@ASCII.ASCII, new-long, Long ASCII
postmaster@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]
#, 215, ASCII@ASCII.ASCII, new-long, Long ASCII
_test@[IPv6:2001:0db8:85a3:0000:0000:8a2e:0370:7334]

-- validated addresses from the UASG resource with corresponding index as id
valid
#, 32, ASCII@ASCII.ASCII, new-long, Long ASCII
email-test@universal-acceptance-test.international
#, 33, ASCII@ASCII.ASCII, new-short, Short ASCII
email-test@universal-acceptance-test.icu
#, 34, Unicode@IDN.IDN, RTL, Arabic
تجربة-بريد-الكتروني@تجربة-القبول-الشامل.موريتانيا
#, 35, Unicode@IDN.IDN, , Armenian
Էլփոստ-թեստ@համընդհանուր-ընկալում-թեստ.հայ
#, 36, Unicode@IDN.IDN, , Bengali Bangla
ই-মেইল-পরীক্ষা@সর্বজনীন-স্বীকৃতির-পরীক্ষা.ভারত
#, 37, Unicode@IDN.IDN, , Cyrillic
почта-тест@универсальное-принятие-тест.москва
#, 38, Unicode@IDN.IDN, , Devanagari
ईमेल-परीक्षण@सार्वभौमिक-स्वीकृति-परीक्षण.संगठन
#, 39, Unicode@IDN.IDN, , Georgian
ფოსტის-ტესტი@უნივერსალური-თავსობადობის-ტესტი.გე
#, 40, Unicode@IDN.IDN, , Greek
ηλεκτρονικό-μήνυμα-δοκιμή@καθολική-αποδοχή-δοκιμή.ευ
#, 41, Unicode@IDN.IDN, , Gujarati
ઇમેઇલ-પરીક્ષણ@સાર્વત્રિક-સ્વીકૃતિ-પરીક્ષણ.ભારત
#, 42, Unicode@IDN.IDN, , Gurmukhi
ਈਮੇਲ-ਪਰਖ@ਸਰਵਵਿਆਪਕ-ਪ੍ਰਵਾਨਗੀ-ਪਰਖ.ਭਾਰਤ
#, 43, Unicode@IDN.IDN, , Hangul
이메일테스트@다국어도메인이용환경테스트.한국
#, 44, Unicode@IDN.IDN, RTL, Hebrew
מבחן-דואר-אלקטרוני@מבחן-קבלה-אוניברסלי.קום
#, 45, Unicode@IDN.IDN, , Hiragana
めーるてすと@どこでもつかえる.みんな
#, 46, Unicode@IDN.IDN, , Kannada
ಇ-ಅಂಚೆ-ಪರೀಕ್ಷೆ@ಸಾರ್ವತ್ರಿಕ-ಸ್ವೀಕಾರಾರ್ಹತೆ-ಪರೀಕ್ಷೆ.ಭಾರತ
#, 47, Unicode@IDN.IDN, , Katakana
メールテスト@ユニバーサルアクセプタンス.クラウド
#, 48, Unicode@IDN.IDN, , Lao
ອີເມວ-ທົດລອງ@ສາກົນ-ການຍອມຮັບ-ທົດລອງ.ລາວ
#, 49, Unicode@IDN.IDN, , Latin
Email-test@Universales-Akzeptanz-Test.vermögensberatung
#, 50, Unicode@IDN.IDN, , Malayalam
ഇമെയിൽ-പരിശോധന@സാർവത്രിക-സ്വീകാര്യതാ-പരിശോധന.ഭാരതം
#, 51, Unicode@IDN.IDN, , Oriya
ଇମେଇଲ-ଟେଷ୍ଟ@ଯୁନିଭରସାଲ-ଏକସେପ୍ଟନ୍ସ-ଟେଷ୍ଟ.ଭାରତ
#, 52, Unicode@IDN.IDN, , Sinhala
ඉ-තැපැල්-පිරික්සුම@විශ්ව-සම්මුති-පිරික්සුම.ලංකා
#, 53, Unicode@IDN.IDN, , Tamil
மின்னஞ்சல்-சோதனை@பொது-ஏற்பு-சோதனை.சிங்கப்பூர்
#, 54, Unicode@IDN.IDN, , Telugu
ఇమెయిల్-పరీక్ష@యూనివర్సల్-ఆమోదం-పరీక్ష.భారత్
#, 55, Unicode@IDN.IDN, , Thai
อีเมลทดสอบ@ยูเอทดสอบ.ไทย
#, 56, Unicode@IDN.IDN, , Simplified Chinese
电子邮件测试@普遍适用测试.我爱你
#, 57, Unicode@IDN.IDN, , Traditional Chinese
電子郵件測試@普遍適用測試.台灣
#, 58, Unicode@IDN.ASCII, , Ethiopic
ኢሜይል-ሙከራ@ሁለንአቀፍ-ተቀባይነት-ሙከራ.com
#, 59, Unicode@IDN.ASCII, , Khmer
សារអេឡិកត្រូនិកសាកល្បង@ការសាកល្បងទទួលយកជាអន្តរជាតិ.com
#, 60, Unicode@IDN.ASCII, , Myanmar
အီးမေးလ်စမ်းသပ်ချက်@အလုံးစုံလက်ခံမှုစမ်းသပ်ချက်.com
#, 61, Unicode@IDN.ASCII, RTL, Thaana
އީމޭލު-ޓެސްޓު@ދުނިޔެ-ގަބޫލުކުރާ-ޓެސްޓު.com
#, 62, Unicode@IDN.ASCII, , Tibetan
གློག་འཕྲིན་བརྟག་དཔྱད@ཡོངས་ཁྱབ་ངོས་ལེན་བརྟག་དཔྱད.com
#, 73, ASCII@ASCII.IDN, RTL, Hebrew
email-test@universal-acceptance-test.קום
#, 74, IDN@IDN.ASCII, , Latin
email-épreuve@épreuve-acceptation-universelle.org
#, 75, IDN@IDN.ASCII, mailbox using uppercase letters, Latin
Email-Épreuve@épreuve-acceptation-universelle.org
#, 76, IDN@IDN.ASCII, domain in non-NFC normalization form, Latin
email-épreuve@épreuve-acceptation-universelle.org
#, 77, IDN@IDN.ASCII, mailbox in non-NFC normalization form, Latin
email-épreuve@épreuve-acceptation-universelle.org
#, 78, IDN@IDN.IDN, Ideographic Full Stop, Simplified Chinese
电子邮件测试@普遍适用测试。我爱你
#, 79, Unicode@IDN.IDN, RTL; A-label.U-label, Arabic
تجربة-بريد-الكتروني@xn-----ctdbabcfhu9c2b9l1acccr4c.موريتانيا
#, 80, Unicode@IDN.IDN, RTL; U-label.A-label, Arabic
تجربة-بريد-الكتروني@تجربة-القبول-الشامل.xn--mgbah1a3hjkrd
#, 81, Unicode@IDN.IDN, RTL; A-label.A-label, Arabic
تجربة-بريد-الكتروني@xn-----ctdbabcfhu9c2b9l1acccr4c.xn--mgbah1a3hjkrd
#, 82, ASCII@IDN.IDN, RTL; A-label.A-label, Arabic
email-test@xn-----ctdbabcfhu9c2b9l1acccr4c.xn--mgbah1a3hjkrd

@AkaeyesWanabe
Copy link
Author

I can found a good regex for utf8 user email checking and quoted user email checking you can try these.

const emailUserUtf8Part = /^(?!\d)(?!...)[a-z\d!#$&'+-/=?^_`{|}~%.\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/iu;

const quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/iu;

@arpanhub
Copy link

iss this issue open to be solved ?

@AkaeyesWanabe
Copy link
Author

I can found a good regex for utf8 user email checking and quoted user email checking you can try these.

const emailUserUtf8Part = /^(?!\d)(?!...)[a-z\d!#$&'+-/=?^_`{|}~%.\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/iu;

const quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|([\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/iu;

Hello. If yu try these code lines from my previous message you can solved this issue. I try it and it worked successfully.

I just edit regex use in our code to find these solution but with AI to go fast. So after many attempts i found these complete regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants