Section: 31.5.1 [re.synopt] Status: C++14 Submitter: Jonathan Wakely Opened: 2014-02-01 Last modified: 2017-09-10
View all other issues in [re.synopt].
View all issues with C++14 status.
As discussed in c++std-lib-35399 and its replies, I can see two possible interpretations of the effects of regex_constants::nosubs:
The effect of nosubs only applies during matching. Parentheses are still recognized as marking a sub-expression by the basic_regex compiler, and basic_regex::mark_count() still returns the number of marked sub-expressions, but anything they match is not stored in the results. This means it is not always true that results.size() == r.mark_count() + 1 for a successful match.
nosubs affects how a regular expression is compiled, altering the state of the std::basic_regex object so that mark_count() returns zero. This also affects any subsequent matching.
The definition of nosubs should make this clear.The wording in 31.5.1 [re.synopt]/1 seems to imply that nosubs only has effects during matching, which is (1), but all known implementations do (2). John Maddock confirmed that (2) was intended.
[Issaquah 2014-02-12: Move to Immediate]
This wording is relative to N3797.
Apply the following edit to the table in 31.5.1 [re.synopt]/1
Specifies that when a regular expression is matched against a character container sequence, no sub-expression matches shall be stored in the supplied match_results structure.