3605. regex_constants::match_prev_avail is underspecified

Section: 28.6.4.3 [re.matchflag] Status: New Submitter: Jonathan Wakely Opened: 2021-09-27 Last modified: 2021-10-14

Priority: 3

View all other issues in [re.matchflag].

View all issues with New status.

Discussion:

The standard doesn't say what it means if match_prev_avail is set. Table [tab:re.matchflag] says:

--first is a valid iterator position. When this flag is set the flags match_not_bol and match_not_bow shall be ignored by the regular expression algorithms (28.6.10 [re.alg]) and iterators (28.6.11 [re.iter]).

What difference does it make whether --first is a valid iterator position or not?

What behaviour is changed when it's a valid iterator position? The standard doesn't say anything else about that.

When do the regex algorithms care about --first?

Examples like regex_match("xa"+1, regex("^a"), match_prev_avail) and regex_match("xa"+1, regex("\\ba"), match_prev_avail) are presumably supposed to inspect the character at --first to determine if there is a match. The standard doesn't specify that *--first is ever inspected, only that it's a valid character (which is a useless guarantee if nothing looks at it).

[2021-10-14; Reflector poll]

Set priority to 3 after reflector poll.

Proposed resolution: