Tuesday, June 12, 2012

Alphanumeric validation check using Regex


String value = "Pankaj Singh 1952";
Pattern pattern = Pattern.compile("[a-zA-Z][a-zA-Z0-9 ]*");
Matcher matcher = pattern.matcher(value);
boolean flag = matcher.matches();

if (flag) {
System.out.println("correct value");
} else {
System.out.println("incorrect value");
}

No comments:

Post a Comment

Spring Boot Config Server and Config Client.

 In Spring cloud config we can externalise our configuration files to some repository like GIT HUT, Amazon S3 etc. Benefit of externalising ...