|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
RE2-compatible construction options. Mirrors real RE2's RE2::Options field-for-field (names, defaults); see the file-level doc comment for which fields this layer honors.
More...
#include <re2.hpp>
Public Types | |
| enum | Encoding : std::uint8_t { EncodingUTF8 , EncodingLatin1 } |
Pattern/text encoding — real::compat::re2 supports EncodingUTF8 only. More... | |
Public Member Functions | |
| Options ()=default | |
| Default options: UTF-8, leftmost-first, case-sensitive, every RE2 default kept. | |
| Options (CannedOptions canned) | |
One of RE2's canned option sets. Implicit, as RE2's own, so a canned set passes where Options is taken. | |
| std::int64_t | max_mem () const noexcept |
The compiled-pattern budget, as RE2's: a program past two thirds of it fails with ErrorPatternTooLarge (at most 1, a 100 000-instruction bound applies instead). Counted in REAL's program bytes (12 per instruction against RE2's 8, no shared prefixes), so a lowered budget does not reject exactly what RE2 rejects; the default rejects nothing REAL compiles. | |
| void | set_max_mem (std::int64_t value) noexcept |
Sets max_mem. | |
| Encoding | encoding () const noexcept |
| The pattern/text encoding. | |
| void | set_encoding (Encoding value) noexcept |
Sets encoding. EncodingLatin1 makes the owning RE2 reject at construction. | |
| bool | posix_syntax () const noexcept |
Whether the pattern is restricted to POSIX egrep syntax; true is rejected at construction. | |
| void | set_posix_syntax (bool value) noexcept |
Sets posix_syntax. | |
| bool | longest_match () const noexcept |
| Whether to search for the longest match instead of the first; honored by every unanchored search. | |
| void | set_longest_match (bool value) noexcept |
Sets longest_match. | |
| bool | log_errors () const noexcept |
Whether compile errors are logged. Reads true by default, as RE2's does; logging itself is opt-in here (see set_log_errors), and RE2::ok()/RE2::error() report errors either way. | |
| void | set_log_errors (bool value) noexcept |
Sets log_errors. Only an explicit set_log_errors(true) arms RE2's stderr message on a failed compile; set_log_errors(false) disarms it. | |
| bool | literal () const noexcept |
Whether the pattern is matched as a literal string rather than parsed as a regex. Honored by escaping the pattern (QuoteMeta) before compiling. | |
| void | set_literal (bool value) noexcept |
Sets literal. | |
| bool | never_nl () const noexcept |
Whether the pattern must never match \n; true is rejected at construction. | |
| void | set_never_nl (bool value) noexcept |
Sets never_nl. | |
| bool | dot_nl () const noexcept |
Whether . also matches \n. Honored via flags::dotall. | |
| void | set_dot_nl (bool value) noexcept |
Sets dot_nl. | |
| bool | never_capture () const noexcept |
Whether every (...) parses as non-capturing; true is rejected at construction, since ignoring it would change NumberOfCapturingGroups() and the Arg extractions. | |
| void | set_never_capture (bool value) noexcept |
Sets never_capture. | |
| bool | case_sensitive () const noexcept |
Whether matching is case-sensitive (a pattern's (?i) overrides it, as in RE2). | |
| void | set_case_sensitive (bool value) noexcept |
Sets case_sensitive. | |
| bool | perl_classes () const noexcept |
Read by RE2 only under posix_syntax, which this layer rejects: inert, as in RE2 without it. | |
| void | set_perl_classes (bool value) noexcept |
Sets perl_classes (inert; see the getter). | |
| bool | word_boundary () const noexcept |
| Inert, as perl_classes is. | |
| void | set_word_boundary (bool value) noexcept |
Sets word_boundary (inert; see the getter). | |
| bool | one_line () const noexcept |
| Inert, as perl_classes is. | |
| void | set_one_line (bool value) noexcept |
Sets one_line (inert; see the getter). | |
Private Attributes | |
| std::int64_t | max_mem_ {8 << 20} |
| RE2's default budget (see max_mem). | |
| Encoding | encoding_ {EncodingUTF8} |
| The pattern/text encoding. | |
| bool | posix_syntax_ {false} |
| POSIX egrep syntax restriction. | |
| bool | longest_match_ {false} |
| Leftmost-longest vs leftmost-first. | |
| bool | log_errors_ {true} |
The log_errors setting, true by default as RE2's. | |
| bool | log_errors_armed_ {false} |
Set by an explicit set_log_errors(true): only then is anything logged. | |
| bool | literal_ {false} |
| Match the pattern as a literal string. | |
| bool | never_nl_ {false} |
Never match \n. | |
| bool | dot_nl_ {false} |
. also matches \n. | |
| bool | never_capture_ {false} |
Parse every (...) as non-capturing. | |
| bool | case_sensitive_ {true} |
| Case-sensitive by default. | |
| bool | perl_classes_ {false} |
| POSIX-mode-only; inert here. | |
| bool | word_boundary_ {false} |
| POSIX-mode-only; inert here. | |
| bool | one_line_ {false} |
| POSIX-mode-only; inert here. | |
Friends | |
| class | RE2 |
RE2-compatible construction options. Mirrors real RE2's RE2::Options field-for-field (names, defaults); see the file-level doc comment for which fields this layer honors.
| enum real::compat::re2::RE2::Options::Encoding : std::uint8_t |
Pattern/text encoding — real::compat::re2 supports EncodingUTF8 only.
| Enumerator | |
|---|---|
| EncodingUTF8 | UTF-8 (the default, and the only encoding this layer honors). |
| EncodingLatin1 | Latin-1 — accepted for API shape, rejected at |
|
inline |
|
inlinenoexcept |
Whether matching is case-sensitive (a pattern's (?i) overrides it, as in RE2).
|
inlinenoexcept |
Whether . also matches \n. Honored via flags::dotall.
. matches a newline.
|
inlinenoexcept |
The pattern/text encoding.
|
inlinenoexcept |
Whether the pattern is matched as a literal string rather than parsed as a regex. Honored by escaping the pattern (QuoteMeta) before compiling.
|
inlinenoexcept |
Whether compile errors are logged. Reads true by default, as RE2's does; logging itself is opt-in here (see set_log_errors), and RE2::ok()/RE2::error() report errors either way.
|
inlinenoexcept |
Whether to search for the longest match instead of the first; honored by every unanchored search.
|
inlinenoexcept |
The compiled-pattern budget, as RE2's: a program past two thirds of it fails with ErrorPatternTooLarge (at most 1, a 100 000-instruction bound applies instead). Counted in REAL's program bytes (12 per instruction against RE2's 8, no shared prefixes), so a lowered budget does not reject exactly what RE2 rejects; the default rejects nothing REAL compiles.
|
inlinenoexcept |
Whether every (...) parses as non-capturing; true is rejected at construction, since ignoring it would change NumberOfCapturingGroups() and the Arg extractions.
|
inlinenoexcept |
Whether the pattern must never match \n; true is rejected at construction.
. and negated classes are barred from matching a newline.
|
inlinenoexcept |
Inert, as perl_classes is.
^/$ match only at the text edges.
|
inlinenoexcept |
|
inlinenoexcept |
Whether the pattern is restricted to POSIX egrep syntax; true is rejected at construction.
|
inlinenoexcept |
Sets case_sensitive.
| [in] | value | The new setting. |
|
inlinenoexcept |
Sets dot_nl.
| [in] | value | The new setting. |
|
inlinenoexcept |
Sets encoding. EncodingLatin1 makes the owning RE2 reject at construction.
| [in] | value | The new encoding. |
|
inlinenoexcept |
Sets literal.
| [in] | value | The new setting. |
|
inlinenoexcept |
Sets log_errors. Only an explicit set_log_errors(true) arms RE2's stderr message on a failed compile; set_log_errors(false) disarms it.
| [in] | value | The new setting. |
|
inlinenoexcept |
Sets longest_match.
| [in] | value | The new setting. |
|
inlinenoexcept |
Sets max_mem.
| [in] | value | The new budget, in bytes. |
|
inlinenoexcept |
Sets never_capture.
| [in] | value | true makes the owning RE2 reject at construction. |
|
inlinenoexcept |
Sets never_nl.
| [in] | value | true makes the owning RE2 reject at construction. |
|
inlinenoexcept |
Sets one_line (inert; see the getter).
| [in] | value | Stored, not consulted. |
|
inlinenoexcept |
Sets perl_classes (inert; see the getter).
| [in] | value | Stored, not consulted. |
|
inlinenoexcept |
Sets posix_syntax.
| [in] | value | true makes the owning RE2 reject at construction. |
|
inlinenoexcept |
Sets word_boundary (inert; see the getter).
| [in] | value | Stored, not consulted. |
|
inlinenoexcept |
Inert, as perl_classes is.
\\b and \\B are enabled.