• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

Password validation 2 Alpha and at least 2 Numeric

I am new to javascript and need to check if a password field has at least 2 alpha and 2 numeric

Here is my script to check for at least one of each but how do I change it to check for at least 2

 if(!theForm.Password.value.match(/^([a-z]+[0-9]+[a-z0-9]*)|([0-9]+[a-z]+[a-z0-9]*)$/i)){
     alert("Password has to have at least one number and one letter character.");
     theForm.Password.focus();
     return false;
  }
return true;

thanks
0
guestsl
Asked:
guestsl
  • 2
  • 2
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
I think you 're better off with two separate matches, something like these regexp's:

    match(/[a-zA-Z].*[a-zA-Z]/)
    match(/[0-9].*[0-9]/)

Anyway, if this doesn't help, ask Community Support to move your question form this Notes TA to the JavaScript Topic Area.
0
 
qwaleteeCommented:
You need to use a bracket notation that includes all the possible characters [0-9A-Za-z]
0
 
qwaleteeCommented:
BTW, why are you asking this in a Lotus Notes forum?
0
 
guestslAuthor Commented:
I asking in the Notes Forum because the javascript is on in a Domino Database on a form used to allow users to reset thier password.

I will also ask in the Javascript forum

thanks for your advice so far
0
 
guestslAuthor Commented:
Thanks for your advice a have manged to get the javascript to work all ok thanks for pointing me in the direction of the Javascript forum that helped a lot
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now