std::regex_error
Aus cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
definiert in Header <regex> | ||
class regex_error :publicstd::runtime_error{ public: | (seit C++11) | |
Definiert den Typ des Objekts als Ausnahmen geworfen, um Fehler aus dem regulären Ausdrücken Bibliothek berichten .
Original:
Defines the type of object thrown as exceptions to report errors from the regular expressions library.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten]Member-Funktionen
konstruiert eine regex_error Objekt Original: constructs a regex_error object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
bekommt die für eine std::regex_constants::error_type regex_error Original: gets the std::regex_constants::error_type for a regex_error The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) |
Inherited from std::exception
Member functions
[virtuell] | Zerstört das Ausnahme-Objekt Original: destructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuellen öffentlichen Member-Funktion of std::exception ) |
[virtuell] | gibt einen erläuternden String Original: returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuellen öffentlichen Member-Funktion of std::exception ) |
[Bearbeiten]Beispiel
#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";}}
Output:
regex_error caught: The expression contained mismatched [ and ]. The code was error_brack