-
Notifications
You must be signed in to change notification settings - Fork 22
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
Updated email address matching pattern #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of \w
here, instead of [a-zA-Z0-9]
, means that accented characters are also matched (unless .NET Regex does something special with [a-zA-Z0-9]
, otherwise it's an ASCII match.)
All round, a good change.
Regexes are one of these where there is no one correct answer. Everyone has a different take, and that is just how they seem to be designed. And I will admit I am no magician in regex. I have generally tried to avoid them in my professional career. I've got it down to one test fail (
|
Completely agree with your statement. |
Its a new learning for me. Thanks for sharing, updated the pull request accordingly. |
Good progress @hiteshbedre, thank you! Still got a few failing legacy tests, want to take a stab at those? |
Yeah sure. |
Handled most of the cases mentioned under "LegacyTests.cs" file.
Mary&Jane@example.org
""test\""blah""@example.com
customer/department@example.com
$A12345@example.com
!def!xyz%abc@example.com
_Yosemite.Sam@example.com
Ima.Fool@example.com
foobar@x.com
foobar@c0m.com
foobar@c_m.com
foo@bar_.com
foo@666.com
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111@example.com
Invalid cases handled:
char)8 + "ar.com
char)9 + "ar.com
char)127 + "ar.com
.wooly@example.com
pootietang.@example.com
.@example.com
foo@bar
foo@bar.a
Pattern not being handled via Regex:
pootietang.@example.com
wo..oly@example.com
foo@bar.1com
foobar@_.com
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111@example.com
Fix for issue #5