RE2::Set: Add patterns, Compile once, then Match repeatedly, on real::regex_set::which(). The anchor is applied by wrapping each pattern, real::regex_set being unanchored.
More...
#include <re2.hpp>
|
| | Set (const Options &options, Anchor anchor) |
| | Starts an empty set.
|
| |
| int | Add (std::string_view pattern, std::string *error) |
| | Buffers one pattern (validated immediately, like real RE2's Add).
|
| |
| bool | Compile () |
| | Compiles every buffered pattern into one real::regex_set.
|
| |
| bool | Match (std::string_view text, std::vector< int > *v) const |
| | Tests text against every compiled member.
|
| |
|
|
Options | options_ |
| | Options shared by every member.
|
| |
|
Anchor | anchor_ |
| | The anchor mode every member is matched with.
|
| |
|
std::vector< std::string > | patterns_ |
| | Buffered, already anchor-wrapped member patterns.
|
| |
|
std::optional< real::regex_set > | set_ |
| | Engaged once Compile succeeds.
|
| |
|
std::size_t | program_bytes_ {0} |
| | The members' programs, in bytes (RE2::program_bytes).
|
| |
|
std::size_t | program_instructions_ {0} |
| | The members' instructions.
|
| |
RE2::Set: Add patterns, Compile once, then Match repeatedly, on real::regex_set::which(). The anchor is applied by wrapping each pattern, real::regex_set being unanchored.
◆ Set()
| real::compat::re2::RE2::Set::Set |
( |
const Options & |
options, |
|
|
Anchor |
anchor |
|
) |
| |
|
inline |
Starts an empty set.
- Parameters
-
| [in] | options | The options applied to every member pattern. |
| [in] | anchor | The anchor mode every member is matched with. |
◆ Add()
| int real::compat::re2::RE2::Set::Add |
( |
std::string_view |
pattern, |
|
|
std::string * |
error |
|
) |
| |
|
inline |
Buffers one pattern (validated immediately, like real RE2's Add).
- Parameters
-
| [in] | pattern | The pattern text. |
| [out] | error | If non-null and the pattern is rejected, set to a human-readable reason. |
- Returns
- The pattern's index (matches
Match's output indices) on success, or -1.
◆ anchor_wrap()
| std::string real::compat::re2::RE2::Set::anchor_wrap |
( |
std::string_view |
pattern | ) |
const |
|
inlineprivate |
Synthesizes anchor_'s semantics by wrapping pattern, since real::regex_set is natively unanchored.
- Parameters
-
| [in] | pattern | The raw member pattern text. |
- Returns
- The pattern text to actually compile.
◆ Compile()
| bool real::compat::re2::RE2::Set::Compile |
( |
| ) |
|
|
inline |
Compiles every buffered pattern into one real::regex_set.
- Returns
true on success; false when the members together exceed max_mem, as RE2's own Compile fails (each member was already probe-compiled by Add).
◆ Match()
| bool real::compat::re2::RE2::Set::Match |
( |
std::string_view |
text, |
|
|
std::vector< int > * |
v |
|
) |
| const |
|
inline |
Tests text against every compiled member.
- Parameters
-
| [in] | text | The subject text. |
| [out] | v | If non-null, cleared and filled with the indices of every matching member. |
- Returns
true if at least one member matched.
The documentation for this class was generated from the following file: