[Solved] Check the characters of a string November 12, 2022 by Kirat Check Regex and Substring For your example it would be something like public boolean isValid(String h) { return h.substring(1).matches("^[A-H0-9]+$"); } 2 solved Check the characters of a string