Behaviour of calling Matcher#end after the last match doesn't match java.util.regex
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 165
- PR merge metrics
- No merged PRs in 30d
Description
This may be related to #200
```java
public class Repro {
public static void main(String[] args) {
{
System.err.println("re2j");
var p = com.google.re2j.Pattern.compile("foo");
var m = p.matcher("foobar");
while (m.find()) {
System.err.println(m.start());
}
System.err.println(m.end());
}
{
System.err.println("java.util.regex");
var p = java.util.regex.Pattern.compile("foo");
var m = p.matcher("foobar");
while (m.find()) {
System.err.println(m.start());
}
System.err.println(m.end());
}
}
}
```
```
re2j
0
3
java.util.regex
0
Exception in thread "main" java.lang.IllegalStateException: No match found
at java.base/java.util.regex.Matcher.checkMatch(Matcher.java:1850)
at java.base/java.util.regex.Matcher.end(Matcher.java:562)
at Repro.main(Repro.java:19)
```
Contributor guide
Assessment
This issue has not been assessed yet.