-
Notifications
You must be signed in to change notification settings - Fork 121
Proper handling of email, schemeless URLs #708
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
Conversation
| } | ||
| } | ||
|
|
||
| private val REGEXP_EMAIL = Regex("^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$", |
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.
Top level domains can be longer than 4 characters now (e.g. .design)
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.
Good point @koke . Any recommendation for how long to change it to? Some cursory googling has produced info for TLDs that can be 24chars long. Localized TLDs in particular start with XN-- which is 4char long to begin with!
I think I will change it to 20chars.
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.
It seems that there is no length limit set for TLDs. Checked on google, and I think we can safely change it to
"^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,}$"
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.
Thanks @daniloercoli , lifted the upper limit with 3e9f744.
|
For reference pasting here the link to email tests taken from chromium. I've also found an interesting post on stackoverflow that could help with Regexps if we decide to investigate this further. |
I added code (with 19c40b3) to encode the link text @daniloercoli . Let me know if that's what you had in mind. By the way, as it currently is, the email regex won't match when there's a doublequote in the link text. How can I reproduce the case in the screenshot you shared above?
Aha, thanks for looking into this! I feel though that an extensive support like that is outside the scope of this PR. Can we do it in a separate PR? If OK with you, can you open a ticket with the support you'd like to see implemented? Thanks! |
I agree and will open a new ticket. |
If you try by inserting
|
|
|
|
Thanks for the merge and for the new ticket @daniloercoli . We can move any regex discussion there I guess, cool? |

Fix #460
This PR mirrors the behavior from Calypso to handle email links and links that need the scheme added.
Test 1
name@company.com, copy the same to the Link text field and tap OKhrefpoints to:mailto:name@company.com(prepended withmailto:)Test 2
#internalanchor, copy the same to the Link text field and tap OKhrefpoints to:#internalanchor(nohttp://added)Test 3
wordpress.org, copy the same to the Link text field and tap OKhrefpoints to:http://wordpress.org(there's an addedhttp://)