ciber Posted February 26, 2009 Share Posted February 26, 2009 I been battling to find a regex statement to do the following: I need to be able to verify an email, but it must only work if the domain matches @mydomain.co.za some of the emails use a . eg, name.surname@mydomain.co.za and some use a 9 digit id alias 123456789@mydomain.co.za anyone got any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/147052-regex-to-approve-email-address/ Share on other sites More sharing options...
rhodesa Posted February 26, 2009 Share Posted February 26, 2009 /^[a-z0-9.]@mydomain\.co\.za$/i Quote Link to comment https://forums.phpfreaks.com/topic/147052-regex-to-approve-email-address/#findComment-772065 Share on other sites More sharing options...
ciber Posted February 27, 2009 Author Share Posted February 27, 2009 hi, it doesnt want to work I even tried it on this tester site, and nothing.?! http://www.fileformat.info/tool/regex.htm Quote Link to comment https://forums.phpfreaks.com/topic/147052-regex-to-approve-email-address/#findComment-772534 Share on other sites More sharing options...
Encrypt Posted February 27, 2009 Share Posted February 27, 2009 ~^[a-z0-9\.]+@mydomain\.co\.za$~i Quote Link to comment https://forums.phpfreaks.com/topic/147052-regex-to-approve-email-address/#findComment-772552 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 yeah...was just gonna update it. I forgot a + /^[a-z0-9.]+@mydomain\.co\.za$/i p.s. - you don't need to escape a period when it's inside [] Quote Link to comment https://forums.phpfreaks.com/topic/147052-regex-to-approve-email-address/#findComment-772553 Share on other sites More sharing options...
Encrypt Posted February 27, 2009 Share Posted February 27, 2009 Thanks, my bad Quote Link to comment https://forums.phpfreaks.com/topic/147052-regex-to-approve-email-address/#findComment-772554 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.