std::regex_error - cppreference.com
提供: cppreference.com
<tbody> </tbody>
|
|
(C++11以上) | |
正規表現ライブラリのエラーを報告するために投げられる例外オブジェクトの型を定義します。
継承図
メンバ関数
regex_error オブジェクトを構築します (パブリックメンバ関数) [edit] | |
regex_error のための std::regex_constants::error_type を取得します (パブリックメンバ関数) [edit] |
例
#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