重複の可能性:
GCCのC++0x正規表現
regexを使用してc++でファイルを変換しようとしましたが、regex_errorが引き続き発生します。コードは、次のとおりです。
std::ifstream inf(in);
std::ofstream outf(out);
try{
std::regex line_regex("[[:alnum:]]");
std::string line;
while(std::getline(inf,line))
{
if(std::regex_match(line,line_regex))
outf<<line<<std::endl;
}
エラーメッセージは次のとおりです。
terminate called after throwing an instance of 'std::regex_error'
what(): regex_error
ちなみに、私はLinuxx64でgcc4.7.2を使用しています。