Section
std::regex_error
Defines the type of exception object thrown to report errors in the regular expressions library.
# Declarations
class regex_error;
(since C++11)
# Example
#include <iostream>
#include <regex>
int main()
{
try
{
std::regex re("[a-b][a");
}
catch (const std::regex_error& e)
{
std::cout << "regex_error caught: " << e.what() << '\n';
if (e.code() == std::regex_constants::error_brack)
std::cout << "The code was error_brack\n";
}
}