问题
In my project, a form for the user to fill the details. In that, one text field to enter email id of the user. So i need to validate the email in that text field, in corona project
回答1:
Try this regular expression:
local email = "email@email.com"
if (email:match("[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?")) then
print("VALID EMAIL")
else
print("INVALID EMAIL")
end
回答2:
Use regular expression pattern for checking email.
Use this "[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?"
回答3:
Try this:
local pattern = "[%w][%p][@][%w]+[.][%w.]+[^.]+"
return value ~= nil and #value >= 1 and #value <= 63 and istring.is_ascii(value) and not not value:match(pattern) and #value:match(pattern) == #value
Ex: email@email.com email@email.com.br
来源:https://stackoverflow.com/questions/21040325/email-address-validation-using-corona-sdk