Localization library | |||||||||||||||||||||||||
Regular expressions library(C++11) | |||||||||||||||||||||||||
Formatting library(C++20) | |||||||||||||||||||||||||
Null-terminated sequence utilities | |||||||||||||||||||||||||
Byte strings | |||||||||||||||||||||||||
Multibyte strings | |||||||||||||||||||||||||
Wide strings | |||||||||||||||||||||||||
Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
Text encoding identifications | |||||||||||||||||||||||||
|
Classes | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
Algorithms | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
Iterators | ||||
(C++11) | ||||
(C++11) | ||||
Exceptions | ||||
regex_error (C++11) | ||||
Traits | ||||
(C++11) | ||||
Constants | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
Regex Grammar | ||||
(C++11) |
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.
Inheritance diagram
Contents |
constructs aregex_error object(public member function)[edit] | |
replaces theregex_error object(public member function)[edit] | |
gets thestd::regex_constants::error_type for aregex_error (public member function)[edit] |
[virtual] | destroys the exception object (virtual public member function of std::exception )[edit] |
[virtual] | returns an explanatory string (virtual public member function of std::exception )[edit] |
#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";}}
Possible output:
regex_error caught: The expression contained mismatched [ and ].The code was error_brack