我有以下正则表达式(
link)
原文链接:https://www.f2er.com/regex/356600.html[\d\.]+[ ](.*?)[ ]{2,}(.+)
但是,等效的Java代码无法匹配:
String REGEX = "[\\d\\.]+[ ](.*?)[ ]{2,}(.+)"; Pattern pattern = Pattern.compile(REGEX); String line = "1. QUEEN WE ARE THE CHAMPIONS" Matcher matcher= pattern.matcher(line); String artist = matcher.group(0); String song = matcher.group(1);
我似乎无法理解出了什么问题,任何想法?