The moose likes Java in General and the fly likes REgular Expression for string validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "REgular Expression for string validation" Watch "REgular Expression for string validation" New topic

REgular Expression for string validation

Anjali Naveen

Joined: Jun 28, 2005
Posts: 15
hey need help to validate a string such that it contains atleast one UPPERCASE, one DIGIT and one SPECIAL CHARACTER. cant seem to get the regular expression for that!!please help
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41124
What do you have so far?

Ping & DNS - my free Android networking tools app
Urs Waefler
Ranch Hand

Joined: Mar 13, 2007
Posts: 77

I had a look at the class String, if there exist such methods. Till now I did not get a usefull idea. Once I thought, maybe you could the method:

public char[] toCharArray()

Then you have to parse an array. Probably there might be for each test one loop.


for (int i = 0; i<array.length; i++){
if(array[i] == ...;


SCJP 1.4
Alan Moore
Ranch Hand

Joined: May 06, 2004
Posts: 262
Anjali Naveen

Joined: Jun 28, 2005
Posts: 15
thanks a ton Allan..that really helped!!...
I agree. Here's the link: http://aspose.com/file-tools
subject: REgular Expression for string validation
Similar Threads
String replacement
regular expression in java question!
Recursive Regular Expression
List to String
Regular Expression Help Needed