Solved

Password validation 2 Alpha and at least 2 Numeric

Posted on 2004-08-10
5
380 Views
Last Modified: 2013-12-18
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
Comment
Question by:guestsl
  • 2
  • 2
5 Comments
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 125 total points
ID: 11770278
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
 
LVL 31

Expert Comment

by:qwaletee
ID: 11778391
You need to use a bracket notation that includes all the possible characters [0-9A-Za-z]
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11778396
BTW, why are you asking this in a Lotus Notes forum?
0
 

Author Comment

by:guestsl
ID: 11779402
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
 

Author Comment

by:guestsl
ID: 11780404
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now