C++ で文字列を取り、中に含まれるプロジェクト名とパスを見つけようとしています。文字列の形式は次のとおりです。
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL01", "OpenGL01\OpenGL01.vcxproj", "{65E58BFD-4339-44BA-BA9B-B2B8A5AC1FE1}"
正規表現は次のとおりです。
boost::regex expression("(Project\(\"\{.*\}\"\)) ?= ?(\".*\"), ?(\".*\"), ?(\"\{.*\}\")");
しかし、この行は例外エラーを生成します:
kmCompile2010.exe の 0x7512d36f で未処理の例外: Microsoft C++ 例外:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::regex_error> >
メモリ位置 0x004ce13c..
これは完全な関数です:
BOOL CSlnFile::ReadProjectsSolution()
{
CString sLine;
boost::regex expression("(Project\(\"\{.*\}\"\)) ?= ?(\".*\"), ?(\".*\"), ?(\"\{.*\}\")");
BOOL bCheck = FALSE;
SeekToBegin();
while(ReadString(sLine) && !bCheck) {
// CString to char*
CT2A temp(sLine); // uses LPCTSTR conversion operator for CString and CT2A constructor
const char* pszA = temp; // uses LPSTR conversion operator for CT2A
std::string strA(pszA); // uses std::string constructor
boost::smatch what;
if (regex_match(strA, what, expression, boost::match_extra)) {
// TODO
}
}
return bCheck;
}
私は自分の間違いを見つけませんでした。手伝って頂けますか?