In the following example, the behaviour of re2j doesn't match the behaviour of java.util.regex, is this expected?
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.joining;
public class T {
public static void main(String[] args) {
String pattern = "\n(?: *\n)+";
String input = "";
int limit = 0;
{
System.err.println("> java.util.regex");
var p = java.util.regex.Pattern.compile(pattern);
print(p.split(input, limit));
}
{
System.err.println("\n> re2j");
var p = com.google.re2j.Pattern.compile(pattern);
print(p.split(input, limit));
}
}
private static void print(String[] split) {
System.err.println(
stream(split).map(x -> String.format("'%s'", x)).collect(joining(", ", "[", "]")));
}
}
> java.util.regex
['']
> re2j
[]
In the following example, the behaviour of re2j doesn't match the behaviour of
java.util.regex, is this expected?