aspose file tools*
The moose likes Struts and the fly likes Regular Expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Regular Expression" Watch "Regular Expression" New topic
Author

Regular Expression

Ashish Bassi
Greenhorn

Joined: Aug 22, 2007
Posts: 11
I need to create a regular expression to check if the password contains
- atleast 1 Capital letter
- atleast 1 Special character
- atleast 1 numeric
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3274
Try the following and test it thoroughly:





look at http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html for explanation.
[ August 22, 2007: Message edited by: arulk pillai ]

500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
http://forum.java.sun.com/thread.jspa?threadID=5208327
Ashish Bassi
Greenhorn

Joined: Aug 22, 2007
Posts: 11
Thank, i tried it, it works in a stand alone java program, not in struts though, inspite of removing the "\" symbol
prakash chandra
Greenhorn

Joined: Aug 14, 2007
Posts: 24
Hi,
Following is the simple code which will fulfill your requirements. It depends on what special character you want in the Password. You can just append the special character you want in static variable SPECIAL of following code.


[ August 22, 2007: Message edited by: prakash chandra ]

SCJP 6.0
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Have a look at RegEx Library.

For your specific req, you may have to search in that, or learn it and build it as per your requirement...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regular Expression