Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a unmatched match in regex?

Tags:

c++

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?

like image 402
Rick Avatar asked Dec 10 '25 11:12

Rick


1 Answers

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).

like image 152
Jarod42 Avatar answered Dec 13 '25 00:12

Jarod42



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!