SSN RegEx in CommonRules

SSN RegEx in CommonRules

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


jkellywilkerson posted on Wednesday, October 11, 2006

Anyone having an issue with the SSN RegEx in CommonRules?  When I use it on a field that is not a required field, it throws a broken rule.  I manually edited the CSLA.CommonRules class and added

|^[/S/s]{0,0}$

to the end of the expression which seems to work; but I do not want to keep track of any modifications to the framework when new releases come out.  Any suggestions?

Thanks,

Kelly.

jwooley replied on Wednesday, October 11, 2006

We must be on the same wavelength. See http://forums.lhotka.net/forums/thread/7522.aspx

Jim Wooley
http://devauthority.com/blogs/jwooley

RockfordLhotka replied on Wednesday, October 11, 2006

fwiw, the regex rule allows you to pass in the regex expression - so you could just do that instead of using the pre-supplied SSN expression.

Of all the things I did in 2.0, I think I regret putting any regex expressions into the framework itself the most. What a PITA they turn out to be...

Regarding the idea of returning true for all empty strings - I am skeptical about that being a good idea. At least not unless it is controlled by a flag in the ruleargs parameter so it is your choice as to whether that should happen or not.

jkellywilkerson replied on Wednesday, October 11, 2006

Please don't get me wrong and think that I'm bashing the framework, because I think CSLA is awesome.  Just was not sure how the regex rules worked (if they were designed for required fields or what) that's all.

Thanks Rocky.

Kelly.

jwooley replied on Wednesday, October 11, 2006

I would agree with the arg option and considered it for simplicity. My problem with the regex as it currently sits is that it appears to be doing two things (breaking pure oop): checking for required and checking for syntax. That's why I recommended isolating the regex check for this rule and using the required rule separately as necessary. Also, it was just easier to do this rather than implementing the a custom RuleArgs class. I'm open to either option.
 
Jim Wooley
http://devauthority.com/blogs/jwooley
----- Original Message -----
From: RockfordLhotka
To: jimwooley@hotmail.com
Sent: Wednesday, October 11, 2006 5:35 PM
Subject: Re: [CSLA .NET] SSN RegEx in CommonRules

fwiw, the regex rule allows you to pass in the regex expression - so you could just do that instead of using the pre-supplied SSN expression.

Of all the things I did in 2.0, I think I regret putting any regex expressions into the framework itself the most. What a PITA they turn out to be...

Regarding the idea of returning true for all empty strings - I am skeptical about that being a good idea. At least not unless it is controlled by a flag in the ruleargs parameter so it is your choice as to whether that should happen or not.



Copyright (c) Marimer LLC