What version of regex are you using?
regex == 1.12.3
Describe the bug at a high level.
regex suppresses empty matches in find_iter() that start at the end of the previous match because it considers them overlapping with the previous match. I disagree with this interpretation, but let's assume that's the case.
regex however still remembers the suppressed empty match and uses it to suppress otherwise completely non-overlapping non-empty matches as well.
What are the steps to reproduce the behavior?
let pattern = "a?|b";
let haystack = "aba";
dbg!(regex::Regex::new(pattern).unwrap().find_iter(haystack).collect::<Vec<_>>());
What is the actual behavior?
We see the following matches:
[
Match {
start: 0,
end: 1,
string: "a",
},
Match {
start: 2,
end: 3,
string: "a",
},
]
What is the expected behavior?
I would expect a match of "" or "b" (or both) at start: 1, but not that there is zero matches starting at index 1.
What version of regex are you using?
regex == 1.12.3Describe the bug at a high level.
regexsuppresses empty matches infind_iter()that start at the end of the previous match because it considers them overlapping with the previous match. I disagree with this interpretation, but let's assume that's the case.regexhowever still remembers the suppressed empty match and uses it to suppress otherwise completely non-overlapping non-empty matches as well.What are the steps to reproduce the behavior?
What is the actual behavior?
We see the following matches:
What is the expected behavior?
I would expect a match of
""or"b"(or both) atstart: 1, but not that there is zero matches starting at index 1.