это работает
String myline = "<status> <id>000000010</id> <created_at>2012/03/11</created_at> <text>@joerogan Played as Joe Savage Rogan in Undisputed3 Career mode, won Pride GP, got UFC title shot against Shields, lost 3 times, and retired</text> <retweet_count>0</retweet_count> <user> <name>Siggi Eggertsson</name> <location>Berlin, Germany</location> <description></description> <url>http://www.siggieggertsson.com</url> </user></status>";
Pattern p = Pattern.compile(".*<id>(.+)</id>.*");
Matcher m = p.matcher(myline);
if (m.matches()) {
String id = m.group(1);
System.out.println(id);
}
[ Edit :] это также работает, и это лучше:
String myline = "<status> <id>000000010</id> <created_at>2012/03/11</created_at> <text>@joerogan Played as Joe Savage Rogan in Undisputed3 Career mode, won Pride GP, got UFC title shot against Shields, lost 3 times, and retired</text> <retweet_count>0</retweet_count> <user> <name>Siggi Eggertsson</name> <location>Berlin, Germany</location> <description></description> <url>http://www.siggieggertsson.com</url> </user></status>";
Pattern p = Pattern.compile("<id>(.+)</id>");
Matcher m = p.matcher(myline);
if (m.find()) {
String id = m.group(1);
System.out.println(id);
}