我的字符串:
<a href="https://MYURL/browse/TEST-53">FOO.BAR</a></p>
代码:
Pattern pattern = Pattern.compile("(browse/)(.*)(\">)");
Matcher matcher = pattern.matcher(match);
return matcher.group(1);
得到错误:
java.lang.IllegalStateException: No match found
在这里测试了我的正则表达式,它确实匹配:
http://regexpal.com/?flags=g®ex=(browse%2F)(.*)(%5C%22%3E)&input=%3Ca%20href%3D%22https%3A%2F%2FMYURL%2Fbrowse%2FTEST-53%22%3EFOO.BAR%3C%2Fa%3E%3C%2Fp%3E