0

C++ で標準ライブラリ メソッドを使用する文字列パーサーを作成しようとしています。入力文字列から、改行または「;」で終わる部分文字列を解析したいと考えています。作成した正規表現オブジェクトから例外が発生し続けます。私のパターンは次のとおりです。

string pattern = "(.+[\\n\\r;])";
regex cmd_sep(pattern);

regex_constants::extended または basic フラグを使用して、または使用せずに試しました。

4

1 に答える 1

0

ブースト ライブラリを使用している場合は、エラー メッセージを投稿することをお勧めします。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;
}
于 2013-04-29T17:13:13.100 に答える