GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::regex_error(3) C++ Standard Libary std::regex_error(3)

std::regex_error - 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.


std-regex error-inheritance.svg


Inheritance diagram

Member functions


constructor constructs a regex_error object
(public member function)
operator= replaces the regex_error object
(public member function)
code 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


destructor destroys the exception object
[virtual] (virtual public member function of std::exception)
what returns an explanatory string
[virtual] (virtual public member function of std::exception)

// 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";
}
}
}


regex_error caught: The expression contained mismatched [ and ].
The code was error_brack

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.