首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

正则表达式-后向引用?解决方法

2012-01-06 
正则表达式-后向引用?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
-----------^---------------


[解决办法]
探讨
小括号和\\k造成的吧..
不太明白正则的意思,貌似?用法有误...

热点排行
Bad Request.