您的最后一个15Sec已经从免费分钟内网收费,离开1Hr 11Min 45Sec
我想解析这个respose。在这里,我想分别获得与小时,分钟和秒相对应的值(例如,它应该返回1小时,11分钟和45秒)。
答案 0 :(得分:1)
试试这个:
/(\d+)Hr (\d+)Min (\d+)Sec/
如何在Java中使用此模式:
Pattern pattern = Pattern.compile("(\\d+)Hr (\\d+)Min (\\d+)Sec");
Matcher matcher = pattern.matcher("Your last 15Sec have been charged from Free minutes onnet ,left 1Hr 11Min 45Sec");
if(matcher.find()) {
String hours = matcher.group(1);
String minutes = matcher.group(2);
String seconds = matcher.group(3);
}