justinwhite Posted April 5, 2008 Share Posted April 5, 2008 Hello, I am quite new with PHP and need a preg_match for email validation like if(!preg_match(-Email Stuff?-, $email)) { die('Invalid email address'); } So, how would I do that? Link to comment https://forums.phpfreaks.com/topic/99762-preg_match/ Share on other sites More sharing options...
quiettech Posted April 5, 2008 Share Posted April 5, 2008 This is unfortunately not an easy subject. It's hard, if not impractical, to create a perfect regex for email validation. RFC2822 doesn't help either. It was written with wide support in mind, not simplicity. With that in mind you should choose the one that suits your fancy. For examples: http://fightingforalostcause.net/misc/2006/compare-email-regex.php or http://regexlib.com/DisplayPatterns.aspx Link to comment https://forums.phpfreaks.com/topic/99762-preg_match/#findComment-510248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.