pub struct RegexSearchQuery { /* private fields */ }Expand description
Reusable compiled regex query used by Document::find_next_regex_query
and the related helpers.
Compilation is performed once at construction time for the byte-engine form; the text-engine form is only compiled when the first rope-backed search call needs it. Repeated searches with the same query reuse those compiled engines instead of paying compilation cost per call.
The pattern is interpreted as Rust’s regex crate syntax. Patterns may use
Unicode-aware classes by default; opt out per-class with the standard
(?-u:...) flag if you need to match raw bytes against a piece-tree or
mmap backing.
Implementations§
Source§impl RegexSearchQuery
impl RegexSearchQuery
Sourcepub fn new(pattern: impl Into<String>) -> Result<Self, RegexCompileError>
pub fn new(pattern: impl Into<String>) -> Result<Self, RegexCompileError>
Compiles a regex pattern into a reusable query.
Returns RegexCompileError when the pattern is invalid or exceeds
the default size limits enforced by the underlying regex crate.
Only the byte-engine form is compiled here; the text-engine form is compiled lazily on first rope-backed search to keep construction cost predictable for callers that only ever search byte-backed documents. Pattern syntax is validated up front through the byte-engine compilation, so a query that compiles here is guaranteed to also compile its text-engine form when needed.