Is this validation is for value of some text box of a html page or for a String variable in java?
If it's java code then use a loop and check ASCII value of each character comes under 65-90 or 97-122(for A-Z and a-z). Keep this loop inside a if block which will check it's length.
// now check value of ch to find if the string contains any thing other that characters or not. you and add the range of numerical digits in condition checking if you want those