I am trying to take a string in C++ and find the project name and path contained inside. The string has the format:
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGL01", "OpenGL01\OpenGL01.vcxproj", "{65E58BFD-4339-44BA-BA9B-B2B8A5AC1FE1}"
And the regular expression is:
boost::regex expression("(Project\(\"\{.*\}\"\)) ?= ?(\".*\"), ?(\".*\"), ?(\"\{.*\}\")");
But this line generate a exception error:
Unhandled exception at 0x7512d36f in kmCompile2010.exe: Microsoft C++ exception:
boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::regex_error> >
at memory location 0x004ce13c..
This is the complete function:
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;
}
I not found my mistake. Can you help me?