Is there a match_partial in C++11 Regular Expressions?
Asked Answered
L

1

7

I read through n1429 with the section

The algorithms regex_match and regex_search both support a feature not commonly seen in regular expression libraries: a partial match. When the flag std::regex_constants::match_partial is set in the flags passed to the algorithm, then a result of true may be returned if one or more characters were matched, and the state machine then reached the end of the character sequence while there were still states to be matched. [...]

But I can not find any trace of that feature in the FCD, nor in the headers of the current gcc-4.7.0. I also looked for a revision of n1429 but again did not find anything. I know that the basis for the proposal had it's origins in Boost and made it into TR1. But I do not know when match_partial disappeared.

Is the partial match feature still in C++11? Maybe with a different name?

Leguminous answered 8/10, 2011 at 9:23 Comment(0)
J
8

It seems the match_partial flag is removed in N1723 "Proposed Resolutions to Library TR Issues" (2004 Oct) as a resolution to N1507 "Errata to the Regular Expression Proposal":

7.34 Meaning of the match_partial flag

Remove match_partial.

The rationale according to N1837 "Library Extension Technical Report  Issues List" is that:

The LWG agrees that this is a useful and implementable feature, but we have repeatedly tried and failed to give it an adequate specification. We hope that it will be possible to add this feature in a future version.

I guess there's no replacement in C++11. You can still use Boost.Regex though (where std::regex comes from), which supports partial match.

Jessi answered 8/10, 2011 at 9:33 Comment(2)
Thanks. I searched for a replacement of the whole N1429, not bold revisions.Leguminous
I have been beating my head trying to figure out why I couldn't match anything! I thought this would be the default behavior in any implementation. Thanks for this.Pasturage

© 2022 - 2024 — McMap. All rights reserved.