2Provides a regex matcher that composes several other regex matchers
5This module is home to a meta [`Regex`], which provides a convenient high
6level API for executing regular expressions in linear time.
8# Comparison with the `regex` crate
10A meta `Regex` is the implementation used directly by the `regex` crate.
11Indeed, the `regex` crate API is essentially just a light wrapper over a meta
12`Regex`. This means that if you need the full flexibility offered by this
13API, then you should be able to switch to using this API directly without
14any changes in match semantics or syntax. However, there are some API level
17* The `regex` crate API returns match objects that include references to the
18haystack itself, which in turn makes it easy to access the matching strings
19without having to slice the haystack yourself. In contrast, a meta `Regex`
20returns match objects that only have offsets in them.
21* At time of writing, a meta `Regex` doesn't have some of the convenience
22routines that the `regex` crate has, such as replacements. Note though that
24will handle the replacement string interpolation for you.
25* A meta `Regex` supports the [`Input`](crate::Input) abstraction, which
26provides a way to configure a search in more ways than is supported by the
27`regex` crate. For example, [`Input::anchored`](crate::Input::anchored) can
28be used to run an anchored search, regardless of whether the pattern is itself
29anchored with a `^`.
30* A meta `Regex` supports multi-pattern searching everywhere.
31Indeed, every [`Match`](crate::Match) returned by the search APIs
32include a [`PatternID`](crate::PatternID) indicating which pattern
33matched. In the single pattern case, all matches correspond to
34[`PatternID::ZERO`](crate::PatternID::ZERO). In contrast, the `regex` crate
35has distinct `Regex` and a `RegexSet` APIs. The former only supports a single
36pattern, while the latter supports multiple patterns but cannot report the
37offsets of a match.
38* A meta `Regex` provides the explicit capability of bypassing its internal
39memory pool for automatically acquiring mutable scratch space required by its
40internal regex engines. Namely, a [`Cache`] can be explicitly provided to lower
41level routines such as [`Regex::search_with`].
45pub use self::{
46 error::BuildError,
47 regex::{
48 Builder, Cache, CapturesMatches, Config, FindMatches, Regex, Split,
49 SplitN,
50 },
53mod error;
54#[cfg(any(feature = "dfa-build", feature = "hybrid"))]
55mod limited;
56mod literal;
57mod regex;
58mod reverse_inner;
59#[cfg(any(feature = "dfa-build", feature = "hybrid"))]
60mod stopat;
61mod strategy;
62mod wrappers;