I want regex to validate for only letters and spaces. Basically this is to validate full name. Ex: Mr Steve Collins or Steve Collins I tried this regex.
check this out.
String name validation only accept alphabets and spaces public static boolean validateLetters(String txt) { String regx = "^[a-zA-Z\\s]+$"; Pattern pattern = Pattern.compile(regx,Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(txt); return matcher.find(); }