Rick
Rick

Reputation: 7516

What is a unmatched match in regex?

From https://en.cppreference.com/w/cpp/regex/match_results/str:

if n >= size(), a string representing the unmatched match is returned.

What is this unmatched match?

Upvotes: 3

Views: 98

Answers (1)

Jarod42
Jarod42

Reputation: 218238

The call is equivalent to string_type((*this)[n]);

and operator[] gives more info:

if n >= size(), returns a reference to a std::sub_match representing an unmatched sub-expression (an empty subrange of the target sequence).

Upvotes: 1

Related Questions