void (MatchData match, StringWithId string) { if (match.matched() && match.byteOffset().end > string.bytes.length) { throw new IllegalStateException( "Match data out of bounds: " + match.byteOffset().start + " > " + string.bytes.length + "\n" + new String(string.bytes, StandardCharsets.UTF_8)); } }