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. String input = "Phone number (714) 321-2620 just texted about property 690 Warwick Avenue (679871)";
  10. Matcher m = Pattern.compile("^Phone number (.*) just texted about property (.*)$").matcher(input);
  11. if(m.find()) {
  12. String first = m.group(1); // (714) 321-2620
  13. String second = m.group(2); // 690 Warwick Avenue (679871)
  14. System.out.println(first);
  15. System.out.println(second);
  16. }
  17. }
  18. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
(714) 321-2620
690 Warwick Avenue (679871)