-
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 a capturing group inside a lookahead, the capturing group isn't correctly backtracked.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) compile the pattern "(?=(\\d))|\\d"
2) match against the input "4"
3) check the value of group 1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Group 1 should have a value of null
ACTUAL -
Actually, group 1 has a value of "4"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Pattern p = Pattern.compile("(?=(\\d))|\\d");
Matcher m = p.matcher("4");
if(m.matches() ){
System.out.println(m.group(1) );
}
---------- END SOURCE ----------
1.8.0_144
A DESCRIPTION OF THE PROBLEM :
When matching against a regular expression that has a capturing group inside a lookahead, the capturing group isn't correctly backtracked.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) compile the pattern "(?=(\\d))|\\d"
2) match against the input "4"
3) check the value of group 1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Group 1 should have a value of null
ACTUAL -
Actually, group 1 has a value of "4"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Pattern p = Pattern.compile("(?=(\\d))|\\d");
Matcher m = p.matcher("4");
if(m.matches() ){
System.out.println(m.group(1) );
}
---------- END SOURCE ----------
- duplicates
-
JDK-8187537 Regular expression wrong start position of matching group
-
- In Progress
-