LuaNET, the lua 5.1 api documentation!

How To/Validate email adresses using regular expressions

When your users register or have an other reason to submit their email address, you want to check if the mail has correct format.

The following code snippet shows validation by using the regular expressions with string.match.

Code
function IsEmailValid(email) 
return string.match(s,"^[%a][%w%.%-]*[%a%d]*@[%a%d][%w%.%-]*[%a%d]%.[%a][%a]?[%a]?[%a]$"))
end
Comments
© 2007 DracoBlue :: Valid XHTML, CSS, RSS Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC | SourceNet © 2007, DracoBlue :: Page created in 0.4 seconds with 18 queries.