Skip to main content

regexp_matches_newline

Function regexp_matches_newline 

pub fn regexp_matches_newline(regexp: &str, dotall: bool) -> bool
Expand description

True iff regexp (a final crate::Pattern::to_regexp output) can match text containing a newline (U+000A) — the exact newline_types predicate.

dotall reflects the grammar-wide re.S/DOTALL bit (g_regex_flags), which the scanner applies to every terminal at match time. Under DOTALL a bare ./ANY consumes a newline, so the classifier must see the same flag or it would false-negative a dot-only terminal (e.g. /.+/ under re.S matches across newlines but would be excluded from newline_types, silently drifting line/column). We parse the HIR with dot_matches_new_line(dotall) so the verdict matches runtime exactly. Per-terminal flags are already baked into regexp by to_regexp(); only the grammar-wide bit arrives here.