[thelist] regex help - password pattern - javascript [solved]
Tom Dell'Aringa
pixelmech at yahoo.com
Wed Sep 28 19:28:05 CDT 2005
--- "Kowalkowski, Lee (ASPIRE)" <lee.kowalkowski at hmrcaspire.com> wrote:
> I'm not sure why you're trying to solve this with 1 regular expression. If
> you have the three rules above, you ought to have three conditions in your
> code. That way you have the opportunity to provide more guidance in your
> error messages. Rather than an unhelpful "invalid password" message, tell
> the user exactly why.
>
> I wouldn't bother with a regular expression for the first rule, just check
> password.length. If you don't allow leading, trailing or any whitespace,
> write a separate condition for that.
>
> The second rule: /(.*\d){2}/.test(password)
>
> The third rule: /(.*[a-z]){2}/i.test(password)
That makes sense (and someone else had mentioned the same thing as well). The way I had been using
my validation setup, I wanted one expression, but I can modify it to use 2-3. Thanks for the help!
Tom
http://www.pixelmech.com/
A man spoke frantically into the phone: "My wife is pregnant and her contractions are only two minutes apart"! "Is this her first child?" the doctor asked. "No, you idiot!" the man shouted. "This is her husband!"
Q: What do you call a muddy chicken who crossed the road two times?
A: A dirty double crosser...
More information about the thelist
mailing list