Liquid Fire Posted February 5, 2007 Share Posted February 5, 2007 code: $email_valid = ereg('^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$', $_REQUEST['email']); error message: Warning: ereg() [function.ereg]: REG_ERANGE in D:\root\projecttracker\include\validateemail.php on line 18 why am i getting this error message when trying to validate an email address? Link to comment https://forums.phpfreaks.com/topic/37102-ereg-error/ Share on other sites More sharing options...
Orio Posted February 5, 2007 Share Posted February 5, 2007 The "range" character (a dash) has a special meaning inside square brackets. You need to escape it: $email_valid = ereg('^[\w\-\.]+@([\w\-]+\.)+[\w\-]{2,4}$', $_REQUEST['email']); Orio. Link to comment https://forums.phpfreaks.com/topic/37102-ereg-error/#findComment-177276 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.