RegexMatcherBuilder (src/matcher.rs)

ripgrep · crates/pcre2/src/matcher.rs · rust · Unlicense
search

A robust builder for PCRE2 regex patterns that provides high-level abstractions like smart-case, word boundaries, and multi-pattern compilation.

// Source: https://github.com/BurntSushi/ripgrep | License: Unlicense
// Provided via justclaw.it.com; keep this notice with the code.
use std::collections::HashMap;

use {
    grep_matcher::{Captures, Match, Matcher},
    pcre2::bytes::{CaptureLocations, Regex, RegexBuilder},
};

use crate::error::Error;

/// A builder for configuring the compilation of a PCRE2 regex.
#[derive(Clone, Debug)]
pub struct RegexMatcherBuilder {
    builder: RegexBuilder,
    case_smart: bool,
    word: bool,
    fixed_strings: bool,
    whole_line: bool,
}

impl RegexMatcherBuilder {
    /// Create a new matcher builder with a default configuration.
    pub fn new() -> RegexMatcherBuilder {
        RegexMatcherBuilder {
            builder: RegexBuilder::new(),
            case_smart: false,
            word:

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key