给出以下输入字符串3481.7.1071.html
我想证实这一点
最后,我想提取最左边的数字(即3481).
我当前的正则表达式几乎就在那里,但我无法捕获正确的组:
final Pattern p = Pattern.compile("(\\d++\\.)+html");
final Matcher m = p.matcher("3481.7.1071.html");
if (m.matches()) {
final String corrected = m.group(1)+"html"; // WRONG! Gives 1071.html
}
Run Code Online (Sandbox Code Playgroud)
我如何捕获第一场比赛?
| 归档时间: |
|
| 查看次数: |
5258 次 |
| 最近记录: |