jeudi 5 février 2015

Regex to match email (not strict)

I would like to validate if an email address is entered by the user but I don't want to be too strict on it... So I came up with this....


My current if statement with regex:



if (preg_match('^/.+?@.+?\..+$/', $_POST["email"]))


However, I would not work for an email address with multiple periods...


For example:



testing@test.one.com


How can I allow multiple . or periods?


Aucun commentaire:

Enregistrer un commentaire