From 96e48b8ac3d6b4210d37fe72433c2d6a381469af Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 19 Oct 2006 23:19:14 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11317 --- checkin_notes | 5 ++--- clientgui/ValidateEmailAddress.cpp | 24 ++++++++++-------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/checkin_notes b/checkin_notes index e7cc976d02..2a9c06f51b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -11244,9 +11244,8 @@ David 19 Oct 2006 run_in_ops (new) Rom 18 Oct 2006 - - Bug Fix: Last regex didn't work right. I've now used a regex from a commerical - software vendor which had a stock email regex and tweaked it a bit to include - TLD's with 6 characters and added a '+' sign as a valid character. + - Bug Fix: Last regex didn't work right. Reverting back to the regex before yesterday's + bug fix and just adding in the other valid characters. What a pain in the butt. clientgui/ ValidateEmailAddress.cpp diff --git a/clientgui/ValidateEmailAddress.cpp b/clientgui/ValidateEmailAddress.cpp index 5f03917c5f..7659f60e05 100644 --- a/clientgui/ValidateEmailAddress.cpp +++ b/clientgui/ValidateEmailAddress.cpp @@ -64,20 +64,16 @@ bool CValidateEmailAddress::Validate(wxWindow *parent) { bool ok = TRUE; wxString val(control->GetValue().Trim().Trim(false)); // trim spaces before and after - // Okay, this is like the 5th iteration of trying to find a good regular expression - // to validate an email address. This time around I went to a commercial package - // that specializes in Regular Expressions. - // - // RegexBuddy - // http://www.regexbuddy.com/ - // - // I took there 99% compatible email regex and added a '+' as a valid character and changed - // the max length of the TLD to be 6 characters. Per there instructions I also made this regex - // case insensitive. - // - // The formal RFC 822 regex is 6343 characters unescaped. ick. - // - wxRegEx reEmail(wxT("^[A-Z0-9.+_%-]+@(?:[A-Z0-9-]+\\.)+[A-Z]{2,6}$"), wxRE_EXTENDED|wxRE_ICASE); + // Regular Expression found here: + // http://www.regexlib.com/REDetails.aspx?regexp_id=284 + // Changes from original: + // Allow additional valid characters in the username area. + wxRegEx reEmail( + wxT("^([a-zA-Z0-9._%+\\-])+(\\.([a-zA-Z0-9_\\-])+)*@((\\[(((([0-1])?([0-9])?[0-9" + "])|(2[0-4][0-9])|(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|" + "(2[0-5][0-5])))\\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\\" + ".(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\\]))|((([a-zA-Z0-9]" + ")+(([\\-])+([a-zA-Z0-9])+)*\\.)+([a-zA-Z])+(([\\-])+([a-zA-Z0-9])+)*))$")); if (val.Length() == 0) { ok = FALSE;