Validation Test With Pattern And Matcher
import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String args[]) throws Exception { Pattern p = Pattern.compile("Java \\d"); String candidate = "this is a Java test"; Matcher m = p.matcher(candidate); System.out.println("result=" + m.find()); } }