REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::compat::regex_constants Namespace Reference

Compatibility constants mirroring std::regex_constants (own values, mapped internally). More...

Typedefs

using error_type = std::regex_constants::error_type
 Error categories, aliased to std's so regex_error::code() is a true drop-in.
 

Enumerations

enum  syntax_option_type : unsigned {
  ECMAScript = 0 , icase = 1U << 0U , nosubs = 1U << 1U , optimize = 1U << 2U ,
  collate = 1U << 3U , multiline = 1U << 4U , basic = 1U << 5U , extended = 1U << 6U ,
  awk = 1U << 7U , grep = 1U << 8U , egrep = 1U << 9U
}
 Grammar / option flags (own bit values; mapped to real::flags or std at construction). More...
 
enum  match_flag_type : unsigned {
  match_default = 0 , match_not_bol = 1U << 0U , match_not_eol = 1U << 1U , match_not_bow = 1U << 2U ,
  match_not_eow = 1U << 3U , match_any = 1U << 4U , match_not_null = 1U << 5U , match_continuous = 1U << 6U ,
  match_prev_avail = 1U << 7U , format_default = 0 , format_sed = 1U << 8U , format_no_copy = 1U << 9U ,
  format_first_only = 1U << 10U
}
 Match-control flags: the common subset. More...
 

Functions

constexpr syntax_option_type operator| (syntax_option_type a, syntax_option_type b) noexcept
 Bitwise OR of two syntax options, so ECMAScript | icase stays typed.
 
constexpr syntax_option_type operator& (syntax_option_type a, syntax_option_type b) noexcept
 Bitwise AND of two syntax options, for testing a bit.
 
constexpr match_flag_type operator| (match_flag_type a, match_flag_type b) noexcept
 Bitwise OR of two match flags.
 
constexpr match_flag_type operator& (match_flag_type a, match_flag_type b) noexcept
 Bitwise AND of two match flags, for testing a bit.
 
constexpr match_flag_type operator~ (match_flag_type a) noexcept
 Bitwise complement of a match-flag set, for masking bits off.
 

Detailed Description

Compatibility constants mirroring std::regex_constants (own values, mapped internally).

Enumeration Type Documentation

◆ match_flag_type

Match-control flags: the common subset.

Enumerator
match_default 

No constraint; the operation may stay on REAL.

match_not_bol 

^ does not match the start of the sequence.

match_not_eol 

$ does not match the end of the sequence.

match_not_bow 

\b does not match at the start.

match_not_eow 

\b does not match at the end.

match_any 

Any match will do; REAL satisfies it by returning the leftmost one.

match_not_null 

Do not match an empty sequence.

match_continuous 

The match must start at the first character.

match_prev_avail 

--first is valid, so ^ and \b may inspect the character before it.

format_default 

ECMAScript replacement syntax, copying the unmatched text.

format_sed 

sed/POSIX replacement syntax (routes to std).

format_no_copy 

Do not copy the parts of the text that did not match.

format_first_only 

Replace only the first match.

◆ syntax_option_type

Grammar / option flags (own bit values; mapped to real::flags or std at construction).

Enumerator
ECMAScript 

The default grammar.

icase 

Case-insensitive (ASCII).

nosubs 

Do not expose sub-expressions (groups still computed).

optimize 

Hint to favour matching speed; honoured as a no-op.

collate 

Locale-sensitive ranges; forces the std backend.

multiline 

^/$ match at line boundaries.

basic 

POSIX BRE — translated onto REAL when the pattern translates, else the std backend.

extended 

POSIX ERE — translated onto REAL when the pattern translates, else the std backend.

awk 

awk grammar (ERE + C escapes) — translated onto REAL when it translates, else std.

grep 

grep grammar (BRE, lines joined by |) — translated onto REAL when it translates, else std.

egrep 

egrep grammar (ERE, lines joined by |) — translated onto REAL when it translates, else std.

Function Documentation

◆ operator&() [1/2]

constexpr match_flag_type real::compat::regex_constants::operator& ( match_flag_type  a,
match_flag_type  b 
)
constexprnoexcept

Bitwise AND of two match flags, for testing a bit.

Parameters
[in]aLeft operand.
[in]bRight operand.
Returns
Their intersection.

◆ operator&() [2/2]

constexpr syntax_option_type real::compat::regex_constants::operator& ( syntax_option_type  a,
syntax_option_type  b 
)
constexprnoexcept

Bitwise AND of two syntax options, for testing a bit.

Parameters
[in]aLeft operand.
[in]bRight operand.
Returns
Their intersection.

◆ operator|() [1/2]

constexpr match_flag_type real::compat::regex_constants::operator| ( match_flag_type  a,
match_flag_type  b 
)
constexprnoexcept

Bitwise OR of two match flags.

Parameters
[in]aLeft operand.
[in]bRight operand.
Returns
Their union.

◆ operator|() [2/2]

constexpr syntax_option_type real::compat::regex_constants::operator| ( syntax_option_type  a,
syntax_option_type  b 
)
constexprnoexcept

Bitwise OR of two syntax options, so ECMAScript | icase stays typed.

Parameters
[in]aLeft operand.
[in]bRight operand.
Returns
Their union.

◆ operator~()

constexpr match_flag_type real::compat::regex_constants::operator~ ( match_flag_type  a)
constexprnoexcept

Bitwise complement of a match-flag set, for masking bits off.

Parameters
[in]aThe flags to complement.
Returns
Every bit of the underlying type that a does not hold.