我需要一个匹配第二个的正则"abc"
表达式"abcasdabchjkabc"
。我尝试编写这样的代码,
Pattern p = Pattern.compile("(?<=abc(.*?))abc");
但它抛出一个java.util.regex.PatternSyntaxException
:
Look-behind group does not have an obvious maximum length near index 11
(?<=abc(.*?))abc
^
at java.util.regex.Pattern.error(Pattern.java:1713)
at java.util.regex.Pattern.group0(Pattern.java:2488)
at java.util.regex.Pattern.sequence(Pattern.java:1806)
at java.util.regex.Pattern.expr(Pattern.java:1752)
at java.util.regex.Pattern.compile(Pattern.java:1460)
at java.util.regex.Pattern.<init>(Pattern.java:1133)
at java.util.regex.Pattern.compile(Pattern.java:823)
请给我看正确的!