fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.util.regex.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. System.out.println("Dev Anand 98-76-543210".matches("\\w+ \\w+ [\\d-]{12}"));
  10. System.out.println(Pattern.compile("\\w+ \\w+ [\\d-]{10}").matcher("Dev Anand 98-76-543210").find());
  11. }
  12. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
true
true