◐ Shell
clean mode source ↗

std::regex_error – cppreference.com

Aus cppreference.com

<metanoindex/>

<tbody> </tbody>

definiert in Header

<regex>

class regex_error : public std::runtime_error { public: explicit regex_error(regex_constants::error_type ecode); regex_constants::error_type code() const; };

(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.

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) [edit]

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) [edit]

Inherited from std::exception

Member functions

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) [edit]

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) [edit]

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