std::regex_error (3) - Linux Manuals
std::regex_error: std::regex_error
Command to display std::regex_error
manual in Linux: $ man 3 std::regex_error
NAME
std::regex_error - std::regex_error
Synopsis
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.
std-regex error-inheritance.svg
Inheritance diagram
Member functions
constructs a regex_error object
constructor (public member function)
gets the std::regex_constants::error_type for a regex_error
code (public member function)
Inherited from std::exception
Member functions
destructor destroys the exception object
(virtual public member function of std::exception)
[virtual]
what returns an explanatory string
(virtual public member function of std::exception)
[virtual]
Example
// Run this code
#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
Pages related to std::regex_error
- std::regex_error::code (3) - std::regex_error::code
- std::regex_error::regex_error (3) - std::regex_error::regex_error
- std::regex_constants (3)
- std::regex_constants::error_type (3) - std::regex_constants::error_type
- std::regex_constants::match_flag_type (3) - std::regex_constants::match_flag_type
- std::regex_constants::syntax_option_type (3) - std::regex_constants::syntax_option_type
- std::regex_iterator (3) - std::regex_iterator
- std::regex_iterator<BidirIt,CharT,Traits>::operator*,operator-> (3) - std::regex_iterator<BidirIt,CharT,Traits>::operator*,operator->
- std::regex_iterator<BidirIt,CharT,Traits>::operator++,operator++(int) (3) - std::regex_iterator<BidirIt,CharT,Traits>::operator++,operator++(int)
- std::regex_iterator<BidirIt,CharT,Traits>::operator= (3) - std::regex_iterator<BidirIt,CharT,Traits>::operator=
- std::regex_iterator<BidirIt,CharT,Traits>::operator==,operator!= (3) - std::regex_iterator<BidirIt,CharT,Traits>::operator==,operator!=
- std::regex_iterator<BidirIt,CharT,Traits>::regex_iterator (3) - std::regex_iterator<BidirIt,CharT,Traits>::regex_iterator
- std::regex_match (3) - std::regex_match
- std::regex_replace (3) - std::regex_replace
- std::regex_search (3) - std::regex_search