language: Java (sun-jdk-1.7.0_10)
date: 366 days 2 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.*;
import java.util.regex.*;
import java.lang.*;
 
class Main
{
        public static void main (String[] args) throws java.lang.Exception
        {
                String title = null, part2 = null, ip = null;
 
                String remoteUriStr = "\"+12222222222\" <sip:+12222222222@192.168.140.1>";
                String regex = "\"(.+?)\" \\<sip:\\+(.+?)@(.+?)\\>";
                Pattern p = Pattern.compile(regex);
                Matcher matcher = p.matcher(remoteUriStr);
                if (matcher.matches()) {
                    title = matcher.group(1);
                    part2 = matcher.group(2);
                    ip = matcher.group(3);
                }
 
                System.out.println("Title: " + title);
                System.out.println("group2: " + part2);
                System.out.println("ip: " + ip);
        }
}