Files
cppdraft_translate/cppdraft/re/matchflag.md
2025-10-25 03:02:53 +03:00

46 lines
5.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[re.matchflag]
# 28 Text processing library [[text]](./#text)
## 28.6 Regular expressions library [[re]](re#matchflag)
### 28.6.4 Namespace std::regex_constants [[re.const]](re.const#re.matchflag)
#### 28.6.4.3 Bitmask type match_flag_type [re.matchflag]
[🔗](#lib:match_flag_type)
namespace std::regex_constants {using match_flag_type = *T2*; inline constexpr match_flag_type match_default = {}; 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](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L9764)
The type match_flag_type is animplementation-defined bitmask type ([[bitmask.types]](bitmask.types "16.3.3.3.3Bitmask types"))[.](#1.sentence-1)
The constants of that type, except for match_default andformat_default, are bitmask elements[.](#1.sentence-2)
The match_default andformat_default constants are empty bitmasks[.](#1.sentence-3)
Matching a regular expression against a sequence of characters
[first, last) proceeds according to the rules of the grammar specified for the regular
expression object, modified according to the effects listed in Table [119](#tab:re.matchflag "Table 119: regex_­constants::match_­flag_­type effects") for
any bitmask elements set[.](#1.sentence-4)
Table [119](#tab:re.matchflag) — regex_constants::match_flag_type effects [[tab:re.matchflag]](./tab:re.matchflag)
| [🔗](#tab:re.matchflag-row-1)<br>**Element** | **Effect(s) if set** |
| --- | --- |
| [🔗](#tab:re.matchflag-row-2)<br>match_not_bol | The first character in the sequence [first, last) shall be treated as though it is not at the beginning of a line, so the character `^` in the regular expression shall not match [first, first)[.](#tab:re.matchflag-row-2-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-3)<br>match_not_eol | The last character in the sequence [first, last) shall be treated as though it is not at the end of a line, so the character `"$"` in the regular expression shall not match [last, last)[.](#tab:re.matchflag-row-3-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-4)<br>match_not_bow | The expression `"\\b"` shall not match the sub-sequence [first, first)[.](#tab:re.matchflag-row-4-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-5)<br>match_not_eow | The expression `"\\b"` shall not match the sub-sequence [last, last)[.](#tab:re.matchflag-row-5-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-6)<br>match_any | If more than one match is possible then any match is an acceptable result[.](#tab:re.matchflag-row-6-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-7)<br>match_not_null | The expression shall not match an empty sequence[.](#tab:re.matchflag-row-7-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-8)<br>match_continuous | The expression shall only match a sub-sequence that begins at first[.](#tab:re.matchflag-row-8-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-9)<br>match_prev_avail | `--first` is a valid iterator position[.](#tab:re.matchflag-row-9-column-2-sentence-1)<br>When this flag is set the flags match_not_bol and match_not_bow shall be ignored by the regular expression algorithms ([[re.alg]](re.alg "28.6.10Regular expression algorithms")) and iterators ([[re.iter]](re.iter "28.6.11Regular expression iterators"))[.](#tab:re.matchflag-row-9-column-2-sentence-2) |
| [🔗](#tab:re.matchflag-row-10)<br>format_default | When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the ECMAScript replace function in ECMA-262, part 15.5.4.11 String.prototype.replace[.](#tab:re.matchflag-row-10-column-2-sentence-1)<br>In addition, during search and replace operations all non-overlapping occurrences of the regular expression shall be located and replaced, and sections of the input that did not match the expression shall be copied unchanged to the output string[.](#tab:re.matchflag-row-10-column-2-sentence-2) |
| [🔗](#tab:re.matchflag-row-11)<br>format_sed | When a regular expression match is to be replaced by a new string, the new string shall be constructed using the rules used by the sed utility in POSIX[.](#tab:re.matchflag-row-11-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-12)<br>format_no_copy | During a search and replace operation, sections of the character container sequence being searched that do not match the regular expression shall not be copied to the output string[.](#tab:re.matchflag-row-12-column-2-sentence-1) |
| [🔗](#tab:re.matchflag-row-13)<br>format_first_only | When specified during a search and replace operation, only the first occurrence of the regular expression shall be replaced[.](#tab:re.matchflag-row-13-column-2-sentence-1) |