tmyonline Posted May 18, 2008 Share Posted May 18, 2008 Hi guys: I need a regex to validate emails of the forms "username@domain.tld" and "username@subdomain.domain.tld" ? How can I achieve this ? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/106128-solved-regex-needed-to-validate-emails/ Share on other sites More sharing options...
Orio Posted May 18, 2008 Share Posted May 18, 2008 I personally use: if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) Orio. Quote Link to comment https://forums.phpfreaks.com/topic/106128-solved-regex-needed-to-validate-emails/#findComment-544023 Share on other sites More sharing options...
tmyonline Posted May 18, 2008 Author Share Posted May 18, 2008 Orio, Thanks a lot. It helps. Quote Link to comment https://forums.phpfreaks.com/topic/106128-solved-regex-needed-to-validate-emails/#findComment-544388 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.