std::regex_...ch_flag_type(3)
std::regex_...ch_flag_type(3) π
okay so this is the C++ Standard Libary page for std::regex_...ch_flag_type(3) β yes, the manual name spells βLibaryβ like that, and we are respecting the canon. Bestie, weβre about to get into regex match flags, and honestly itβs giving bitmask royalty. π
πΈ NAME πΈ
std::regex_constants::match_flag_type β std::regex_constants::match_flag_type.
Thatβs it. Thatβs the name. The repetition is iconic, no notes. β¨
β¨ Synopsis β¨
First up, the (until C++17) version:
Defined in header <regex>
using match_flag_type = /* implementation-defined */; (1) (since C++11)
constexpr match_flag_type match_default = {};
constexpr match_flag_type match_not_bol = /* unspecified */;
constexpr match_flag_type match_not_eol = /* unspecified */;
constexpr match_flag_type match_not_bow = /* unspecified */;
constexpr match_flag_type match_not_eow = /* unspecified */;
constexpr match_flag_type match_any = /* unspecified */;
constexpr match_flag_type match_not_null = /* unspecified */; (since C++11)
constexpr match_flag_type match_continuous = /* unspecified */;
constexpr match_flag_type match_prev_avail = /* unspecified */;
constexpr match_flag_type format_default = {};
constexpr match_flag_type format_sed = /* unspecified */;
constexpr match_flag_type format_no_copy = /* unspecified */;
constexpr match_flag_type format_first_only = /* unspecified */;
Then (since C++17) rolls in with inline constexpr and a (2) marker on match_default:
inline constexpr match_flag_type match_default = {}; (2)
inline constexpr match_flag_type match_not_bol = /* unspecified */;
inline constexpr match_flag_type match_not_eol = /* unspecified */;
inline constexpr match_flag_type match_not_bow = /* unspecified */;
inline constexpr match_flag_type match_not_eow = /* unspecified */;
inline constexpr match_flag_type match_any = /* unspecified */;
inline constexpr match_flag_type match_not_null = /* unspecified */;
inline constexpr match_flag_type match_continuous = /* unspecified */;
inline constexpr match_flag_type match_prev_avail = /* unspecified */;
inline constexpr match_flag_type format_default = {};
inline constexpr match_flag_type format_sed = /* unspecified */;
inline constexpr match_flag_type format_no_copy = /* unspecified */;
inline constexpr match_flag_type format_first_only = /* unspecified */;
(1) match_flag_type is a BitmaskType that specifies additional regular expression matching options. π«Ά
π Constants π
Note: [first, last) refers to the character sequence being matched.
match_not_bolβ The first character in[first, last)will be treated as if it is not at the beginning of a line (i.e.^will not match[first, first)).match_not_eolβ The last character in[first, last)will be treated as if it is not at the end of a line (i.e.$will not match[last, last)).match_not_bowβ\bwill not match[first, first).match_not_eowβ\bwill not match[last, last).match_anyβ If more than one match is possible, then any match is an acceptable result.match_not_nullβ Do not match empty sequences.match_continuousβ Only match a sub-sequence that begins atfirst.match_prev_availβ--firstis a valid iterator position. When set, causesmatch_not_bolandmatch_not_bowto be ignored.format_defaultβ Use ECMAScript rules to construct strings instd::regex_replace(syntax documentation).format_sedβ Use POSIX sed utility rules instd::regex_replace(syntax documentation).format_no_copyβ Do not copy un-matched strings to the output instd::regex_replace.format_first_onlyβ Only replace the first match instd::regex_replace.
All constants, except for match_default and format_default, are bitmask elements. The match_default and format_default constants are empty bitmasks. π
π«Ά Defect reports π«Ά
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR
LWG 2053, applied to C++11- Behavior as published:
- the constants were declared
static match_defaultandformat_defaultwere initialized from0
- the constants were declared
- Correct behavior:
- removed the
staticspecifier - initialized from
{}
- removed the
- Behavior as published:
π See also π
regex_match(C++11)β attempts to match a regular expression to an entire character sequence (function template).syntax_option_type(C++11)β general options controlling regex behavior (typedef).error_type(C++11)β describes different types of matching errors (typedef).
xoxo, your regex bestie π β source: http://cppreference.com, version/date: 2024.06.10, page: std::regex_...ch_flag_type(3). Slay. β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms