Gets whether or not the next line matches the given pattern.
bool matchesNext(RegExp regex) { if (next == null) { return false; } return regex.hasMatch(next!); }