There is a sentence: "I was born 08/02/1996. And my brother is 09/09/2000". If the string contains a number, month and year, return true; if not, then false. Here is my code. In regular expressions, I am very weak. What needs to be fixed in the second line?
public static void date(String s) { Pattern p = Pattern.compile("/([0-2]\\d|3[01])\\.(0\\d|1[012])\\.(\\d{4})/"); Matcher m = p.matcher(s); boolean b = m.matches(); System.out.println(b); }