Minor enhancement request for Email Regex

Minor enhancement request for Email Regex

Old forum URL: forums.lhotka.net/forums/t/7083.aspx


RobKraft posted on Thursday, June 11, 2009

The Email Regex in CSLA Validation restricts the last qualifier of the email address to 2 to 4 characters. Currently, two valid domain extensions are larger (.museum and .travel). Also, in 2011? many more Top Level Domains of longer length may be added.

http://www.eweek.com/c/a/Web-Services-Web-20-and-SOA/Firms-Unaware-of-Web-Domain-Changes-Survey-Says-806502/

Could you change the Regex soon in preparation for the new TLDs?

RockfordLhotka replied on Friday, June 12, 2009

There are few things in CSLA that I regret more than having put any regular expressions into the framework. What a PITA.

I'll add this to the wish list, but I must say that I am seriously considering making a breaking change to just remove the regular expressions (not the RegEx rule) from the framework so I don't have to mess with this sort of thing forever.

Tom_W replied on Saturday, June 13, 2009

Just a thought...

Could the regular expressions be split out of the framework and into a separate library contrib project?  That would at least mean all the hard work you'd put into them wouldn't be lost and would avoid everyone coding the same regex's. 

RockfordLhotka replied on Saturday, June 13, 2009

The RegEx rule method allows you to provide the regular expression. The 3 expressions in the framework are just there for convenience – and that’s the part that I think was a mistake.

 

Take email. There are a whole lot of expressions out there to validate email addresses. And they keep changing, and people argue over who’s is the best. There’s a whole little mini-religion over the email regex – not unlike the VB/C# debate, only it is all about a silly little text string…

 

Rocky

 

From: Tom_W [mailto:cslanet@lhotka.net]
Sent: Saturday, June 13, 2009 7:07 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Minor enhancement request for Email Regex

 

Just a thought...

Could the regular expressions be split out of the framework and into a separate library contrib project?  That would at least mean all the hard work you'd put into them wouldn't be lost and would avoid everyone coding the same regex's. 


Tom_W replied on Saturday, June 13, 2009

LOL, not another one... who'd like to enter into a debate on singular or plural table names while we're at it... (please, nobody do that!)

Sorry, all I meant was why not pull the 3 regexs out of the framework and stick them in a separate file that people can use as a basis for their regex's, that way anyone who wants to change them can do so (and most importantly that 'anyone' is not you!)

RobKraft replied on Friday, June 19, 2009

I agree with Tom_W, let the community do it. We already have other Regex of our own that we've added and using our own email Regex instead of the CSLA Regex is easy. I just wanted to make sure you were aware of the upcoming domain changes in case you felt maintaining that Regex was important.

RockfordLhotka replied on Saturday, June 20, 2009

I am very glad you brought up the issue – I didn’t know about it.

 

And I appreciate the feedback regarding whether to keep the built-in expressions.

 

 

From: RobKraft [mailto:cslanet@lhotka.net]
Sent: Friday, June 19, 2009 8:24 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] RE: Minor enhancement request for Email Regex

 

I agree with Tom_W, let the community do it. We already have other Regex of our own that we've added and using our own email Regex instead of the CSLA Regex is easy. I just wanted to make sure you were aware of the upcoming domain changes in case you felt maintaining that Regex was important.

skagen00 replied on Monday, June 22, 2009

Seems to me the whole notion of what RegEx is appropriate for e-mail/etc and maintaining a listing of various RegEx expressions for each purpose is entirely agnostic and separate from CSLA...

There are entire sites out there dedicated towards the goal of educating on and providing examples for regular expressions.. one is http://www.regular-expressions.info/ -- there was another one which was a bit more to the point and provided for a rating system on various peoples' RegEx expressions. Not to say some people might not have interest in maintaining a RegEx list here - but maybe that need is already being served.

Also, if I remember right, Rocky's regular expression on E-mail doesn't allow an empty string to pass - so I bet most people aren't even using that one... anyways, it would be a pretty easy breaking change to adjust to I would imagine.

Chris

Copyright (c) Marimer LLC