We use cookies to improve your experience, for authentication and to ensure that we show you advertising that is relevant to you. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on Ideone website. However, if you wish, you can change cookie settings of your browser at any time.
Embed source code on your page
source code clone
download
copy to clipboard
report bug / make suggestion
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) ;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4Lio7CmltcG9ydCBqYXZhLmxhbmcuKjsKCmNsYXNzIE1haW4KewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJU3RyaW5nIHRpdGxlID0gbnVsbCwgcGFydDIgPSBudWxsLCBpcCA9IG51bGw7CgoJCVN0cmluZyByZW1vdGVVcmlTdHIgPSAiXCIrMTIyMjIyMjIyMjJcIiA8c2lwOisxMjIyMjIyMjIyMkAxOTIuMTY4LjE0MC4xPiI7CgkJU3RyaW5nIHJlZ2V4ID0gIlwiKC4rPylcIiBcXDxzaXA6XFwrKC4rPylAKC4rPylcXD4iOwoJCVBhdHRlcm4gcCA9IFBhdHRlcm4uY29tcGlsZShyZWdleCk7CgkJTWF0Y2hlciBtYXRjaGVyID0gcC5tYXRjaGVyKHJlbW90ZVVyaVN0cik7CgkJaWYgKG1hdGNoZXIubWF0Y2hlcygpKSB7CgkJICAgIHRpdGxlID0gbWF0Y2hlci5ncm91cCgxKTsKCQkgICAgcGFydDIgPSBtYXRjaGVyLmdyb3VwKDIpOwoJCSAgICBpcCA9IG1hdGNoZXIuZ3JvdXAoMyk7CgkJfQoKCQlTeXN0ZW0ub3V0LnByaW50bG4oIlRpdGxlOiAiICsgdGl0bGUpOwoJCVN5c3RlbS5vdXQucHJpbnRsbigiZ3JvdXAyOiAiICsgcGFydDIpOwoJCVN5c3RlbS5vdXQucHJpbnRsbigiaXA6ICIgKyBpcCk7Cgl9Cn0=
clone
download
copy to clipboard
input / output show all
hide all
upload with new input
result:
Success
time: 0.07s
memory: 380224 kB
returned value: 0
output:
Title: +12222222222
group2: 12222222222
ip: 192.168.140.1
result:
Success
time: 0.07s
memory: 380160 kB
returned value: 0
input:
"\"(.+?)\" \\<sip:\\+(.+?)@(.+?)\\>"
output:
Title: +12222222222
group2: 12222222222
ip: 192.168.140.1
result:
Success
time: 0.07s
memory: 380160 kB
returned value: 0
output:
Title: +12222222222
group2: 12222222222
ip: 192.168.140.1
result:
Success
time: 0.03s
memory: 245632 kB
returned value: 0
input: no
output:
Title: +12222222222
group2: 12222222222
ip: 192.168.140.1
Choose your language:
Help us translate Ideone - click here