-
Bug
-
Resolution: Unresolved
-
P4
-
8, 9
-
generic
-
generic
FULL PRODUCT VERSION :
1.8.0_144
A DESCRIPTION OF THE PROBLEM :
When matching against a regular expression that has nested capturing groups inside a lazy repetition, the nested capturing groups aren't backtracked!
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) compile the pattern "(?:([a-z]([a-z]))+?|[a-z]+)[a-z]"
2) match against the input "abcd"
3) check the value of group 2
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Group 2 should have a value of null!
ACTUAL -
Actually, Group 2 has a value of "d"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Pattern p = Pattern.compile("(?:([a-z]([a-z]))+?|[a-z]+)[a-z]");
Matcher m = p.matcher("abcd");
if(m.matches() ){
System.out.println("Group 2 " + m.group(2) );
}
---------- END SOURCE ----------
1.8.0_144
A DESCRIPTION OF THE PROBLEM :
When matching against a regular expression that has nested capturing groups inside a lazy repetition, the nested capturing groups aren't backtracked!
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) compile the pattern "(?:([a-z]([a-z]))+?|[a-z]+)[a-z]"
2) match against the input "abcd"
3) check the value of group 2
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Group 2 should have a value of null!
ACTUAL -
Actually, Group 2 has a value of "d"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Pattern p = Pattern.compile("(?:([a-z]([a-z]))+?|[a-z]+)[a-z]");
Matcher m = p.matcher("abcd");
if(m.matches() ){
System.out.println("Group 2 " + m.group(2) );
}
---------- END SOURCE ----------