public member function
Test whether object has no matches
Returns true if the match_results object contains no matches.
When the object is default-constructed, this value is initialized to true. If a call to regex_match or regex_search with the match_results object as argument finds at least one match, this value is set to false. If no matches are found, it is set to true.
To check whether the object has already been filled by one of these functions (without distinguishing whether the pattern was successfully matched or not), you can use match_results::ready.
true if the object contains no matches. false if at least contains one.
// - using smatch, a standard alias of match_results<string::iterator>
int main ()
using namespace std::regex_constants;
std::string s ("Subject");
std::regex e1 ("sub.*");
std::regex e2 ("sub.*", ECMAScript | icase);
std::regex_match ( s, m1, e1 );
std::regex_match ( s, m2, e2 );
std::cout << "e1 " << ( m1.empty() ? "did not match" : "matched" ) << std::endl;
std::cout << "e2 " << ( m2.empty() ? "did not match" : "matched" ) << std::endl;
e1 did not match