Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
C++ で標準ライブラリ メソッドを使用する文字列パーサーを作成しようとしています。入力文字列から、改行または「;」で終わる部分文字列を解析したいと考えています。作成した正規表現オブジェクトから例外が発生し続けます。私のパターンは次のとおりです。
string pattern = "(.+[\\n\\r;])"; regex cmd_sep(pattern);
regex_constants::extended または basic フラグを使用して、または使用せずに試しました。
ブースト ライブラリを使用している場合は、エラー メッセージを投稿することをお勧めします。boost::regexタグが抜けている可能性があります。
boost::regex
これを試して
#include <boost/regex.hpp> #include <string> using namespace std; int main () { string pattern = "(.+[\\n\\r;])"; static const boost::regex cmd_sep(pattern); return 0; }