Check AplhaNumeric Inputs

How do I confirm if an input is AplhaNumeric or only numbers or only chars ?

Use String.matches() method.

if(param.matches("^[a-zA-Z]+\$")) {
	println "only chars"
}
else if(param.matches("^[0-9]+\$")) {
	println "only numbers"
}
else if(param.matches("^[0-9a-zA-Z]+\$")) {
	println "alphanumeric"
}

Thanks a lot… You have saved my day :smiley: