Improve handling of email, and schemeless URLs
Handling of email and schemeless URLs was added in https://github.com/wordpress-mobile/AztecEditor-Android/pull/708 for email addresses with "common" characters.
We should extend the support to email address with less common characters in it, like doublequote.
dan"@text.com
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.
Since this is just about detecting something that looks like an email and we don't really need validation, I'd say the simplest way to do it is to treat anything with a @ that is not a URL as an email.
Linking to core's implementation for reference: https://github.com/WordPress/WordPress/blob/6e215cae4838d64d1b21db503c2b57730994bc55/wp-includes/js/tinymce/plugins/link/plugin.js#L498
Since this is just about detecting something that looks like an email and we don't really need validation
Well, it's more than this. If the user adds an URL without the http prefix at the beginning of it, we need to properly detect if it is a valid URL or an email. Checking for the presence of @ is not a valid test.
If we detect the user inserted a valid URL we need to add the http:// prefix to it, otherwise, WP backend, prepend the URL of your site to it. If we just fallback on checking the presence of @ in the inserted URL we may prepend the valid URL that contains @ in it with the prefix mailto:.
As @koke suggested, we can follow how core handled it and display a confirmation dialog ('The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?')instead on going crazy on detecting what is an email or not. For all other address, if the http prefix is not at the beginning add it.