Wrox Home  
Search P2P Archive for: Go

  Return to Index  

regular_expressions thread: Password Validation


Message #1 by "Vijay" <hai_vijay@m...> on Fri, 14 Feb 2003 07:10:59
Thank you very much for  your code now I tried using the code it is 
working perfectly.

Thanks
Vijay

> Seeing as this is the regular_expressions list, try the following:

function validateText(text) {
	var upperCase = /[A-Z]/;
	var lowerCase = /[a-z]/;
	var number = /\d/;
	var specialChar = /[^A-Za-z0-9]/;
	return
(upperCase.test(text)&&lowerCase.test(text)&&number.test(text)
&&specialChar.
test(text));
}

The last statement matches anything that isn't a letter or a digit. If you
want to disallow spaces, insert var spaceChar = / /; and add a
&&!spaceChar.test(text) to the end of the return statement. 

-----Original Message-----
From: Vijay [mailto:hai_vijay@m...]
Sent: 14 February 2003 12:41
To: Regular Expressions
Subject: [regular_expressions] Password Validation


Hi

I wanted to validate the password field which should contain atleast one 
Upper case letter, one lower case letter , one number & one special 
character please help me if there is any javascript code to do the above 
said validations.

Thanks is Advance

Vijay
---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to


  Return to Index