I have the following regex ( link )
[\d\.]+[ ](.*?)[ ]{2,}(.+)
However, the equivalent Java code does not match:
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);
I can’t understand what’s going wrong, any ideas?
source share