TomH Posted July 20, 2007 Share Posted July 20, 2007 I am getting an error with preg_match, the error is: Warning: preg_match() [function.preg-match]: Compilation failed: unmatched parentheses at offset 123 in /newsletter.php on line 16 Line 16 - if(preg_match('/\A(?:[a-zA-Z0-9]!#$%&\'*+\/=?^_`{|}~-])+(?:\.[a-zA-Z0-9]!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-z0-9])?\.))+(?:[a-zA-Z]{2}|com|org|net\b)\Z/i',$email)) return true; Any ideas? Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 20, 2007 Share Posted July 20, 2007 You have an extra parentheses in your regex. I can see it right away. Quote Link to comment Share on other sites More sharing options...
effigy Posted July 20, 2007 Share Posted July 20, 2007 For an expression of this magnitude, I recommend using the /x modifier and spreading the pattern across multiple lines. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 20, 2007 Share Posted July 20, 2007 Yeash...I havent looked at it in detail but as far as the extra parantheses goes...highlighted it for you... if(preg_match('/\A(?:[a-zA-Z0-9]!#$%&\'*+\/=?^_`{|}~-])+(?:\.[a-zA-Z0-9]!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-z0-9])?\.))+(?:[a-zA-Z]{2}|com|org|net\b)\Z/i',$email)) Quote Link to comment Share on other sites More sharing options...
TomH Posted July 20, 2007 Author Share Posted July 20, 2007 Thanks all Quote Link to comment 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.