Jump to content

Validate Email Addresses


LonelyRoad

Recommended Posts

I am trying to validate an email address passed to a function (as shown in the code below) but no matter what I give the function it always returns no match (and the outputchatbox runs twice for some reason).

function validateEmail(email) 
    local email = tostring(email) 
    if (email:match("[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?")) then 
        outputChatBox("Match!") 
        return true 
    else 
        outputChatBox("No Match!") 
        return false 
    end 
end 
addCommandHandler("testing", validateEmail) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...