std::regex_error
提供: cppreference.com
ヘッダ <regex> で定義 | ||
class regex_error; | (C++11以上) | |
正規表現ライブラリのエラーを報告するために投げられる例外オブジェクトの型を定義します。
目次 |
[編集]メンバ関数
regex_error オブジェクトを構築します (パブリックメンバ関数) | |
regex_error のための std::regex_constants::error_type を取得します (パブリックメンバ関数) |
std::exception から継承
メンバ関数
[仮想] | 例外オブジェクトを破棄します ( std::exception の仮想パブリックメンバ関数) |
[仮想] | 説明文字列を返します ( 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