Hi,
I was going to secure and valid email in my code, then I searched in google and found the Regex , but I can’t use this, because the # or … has been used in it.
def validate_email(params) do
Regex.match?(~r/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/, "#{params}")
end
Please help me for converting it to elixir Regex. Thank you in advance for the sake of answering me.
You should be very careful about validating email addresses with regex. My favourite approach is to “validate” it on the client (browser or app), and, if that verification fails, show a small “warning” note that the email address might not be valid (just so that the user might notice a possible typo) but allow to use it anyway and actually check it via email verification.
YES, PLEASE. I have a simple gmail userid since I joined early. There are close to a dozen people who have mistakenly given my email address instead of theirs for various services. The services that send a verification email that I ignore are awesome! The ones that assume they gave the right address are a pain.