fork(10) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3. import java.lang.*;
  4.  
  5. class Main
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. String title = null, part2 = null, ip = null;
  10.  
  11. String remoteUriStr = "\"+12222222222\" <sip:+12222222222@192.168.140.1>";
  12. String regex = "\"(.+?)\" \\<sip:\\+(.+?)@(.+?)\\>";
  13. Pattern p = Pattern.compile(regex);
  14. Matcher matcher = p.matcher(remoteUriStr);
  15. if (matcher.matches()) {
  16. title = matcher.group(1);
  17. part2 = matcher.group(2);
  18. ip = matcher.group(3);
  19. }
  20.  
  21. System.out.println("Title: " + title);
  22. System.out.println("group2: " + part2);
  23. System.out.println("ip: " + ip);
  24. }
  25. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
Title: +12222222222
group2: 12222222222
ip: 192.168.140.1