std::regex_error
| Defined in header <regex>
|
||
| class regex_error; |
(since C++11) | |
Defines the type of exception object thrown to report errors in the regular expressions library.
Contents |
[edit] Member functions
constructs a regex_error object (public member function) | |
replaces the regex_error object (public member function) | |
gets the std::regex_constants::error_type for a regex_error (public member function) |
Inherited from std::runtime_error
Inherited from std::exception
Member functions
| [virtual] |
destroys the exception object (virtual public member function of std::exception)
|
| [virtual] |
returns an explanatory string (virtual public member function of std::exception)
|
[edit] Example
#include <regex> #include <iostream> 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"; } } }
Possible output:
regex_error caught: The expression contained mismatched [ and ]. The code was error_brack

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

