Skip to main content

match_haystack

Function match_haystack 

Source
pub fn match_haystack(
    compiled: &dyn CompiledRegex,
    haystack: &str,
    invert: bool,
) -> Option<Vec<Range<usize>>>
Expand description

Match one haystack against a compiled pattern and apply the invert flag. Returns Some(spans) if the line should be emitted — an empty Vec in invert mode (since we don’t highlight “did-not-match” lines), or the actual match byte ranges otherwise. Returns None if the line should be filtered out. Centralizing this keeps filter_lines, filter_lines_with_extracted, and the TUI collect_matches paths from drifting.