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 开发者_Python百科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?
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.
精彩评论