Skip to content
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

Fix issues with emailRegexPattern. #1640

Merged
merged 4 commits into from
Nov 27, 2014
Merged

Fix issues with emailRegexPattern. #1640

merged 4 commits into from
Nov 27, 2014

Conversation

farmdawgnation
Copy link
Member

This resolve issues with emailRegexPattern not being up to date w.r.t. new TLDs longer than four characters. While I was in there I also made the matcher case insensitive.

fixes #1634

The suggested solution by Diego was to make the limit 10, but making it
unbounded probably makes more sense. It lets people use custom TLDs in
local delivery / email testing without having to worry about length.
@@ -32,7 +32,7 @@ object ProtoRules extends Factory with LazyLoggable {
* The regular expression pattern for matching email addresses. This
* assumes that the email address has been converted to lower case.
*/
val emailRegexPattern = new FactoryMaker(Pattern.compile("^[a-z0-9._%\\-+]+@(?:[a-z0-9\\-]+\\.)+[a-z]{2,4}$")) {}
val emailRegexPattern = new FactoryMaker(Pattern.compile("(?i)^[a-z0-9._%\\-+]+@(?:[a-z0-9\\-]+\\.)+[a-z]{2,}$")) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be clearer if we want the insensitivity to apply throughout to apply it as the second flags parameter to compile rather than in the regex.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to fix the comment that indicates the email should be lowercase.

This should make the case insensitivity of the pattern more visible to
someone else who is looking at the code.
@farmdawgnation
Copy link
Member Author

All comments addressed.

@fmpwizard
Copy link
Member

👍

@fmpwizard fmpwizard added this to the 3.0-M3 milestone Nov 24, 2014
@farmdawgnation
Copy link
Member Author

@fmpwizard Why'd you move this to the M3 milestone? It looks like it's ready to go yeah?

@farmdawgnation
Copy link
Member Author

Oh 3.0-M2 already shipped. lol

farmdawgnation added a commit that referenced this pull request Nov 27, 2014
This resolve issues with emailRegexPattern not being up to date w.r.t. new TLDs longer than four characters and being case sensitive.
@farmdawgnation farmdawgnation merged commit 62d4021 into master Nov 27, 2014
@farmdawgnation farmdawgnation deleted the msf_issue_1634 branch November 27, 2014 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in ProtoRules.emailRegexPattern
3 participants