正则表达式-后向引用?Java codepublic class Test {public static void main(String[] args) {String str
正则表达式-后向引用?
Java code
public class Test { public static void main(String[] args) { String str = "go go"; String r5 = "\\b(?<Word>\\w+)\\b\\s+\\k<Word>\\b"; System.out.println(str.matches(r5)); }}
怎么编译是错误呢?Exception in thread "main" java.util.regex.PatternSyntaxException: Look-behind group does not have an obvious maximum length near index 12 \b(?<Word>\w+)\b\s+\k<Word>\b -----------^---------------