Может кто-нибудь сказать мне, что не так с приведенным ниже кодом, я пытаюсь проанализировать файлы CSV с помощью приведенной ниже программы, но в поле m_uNumGroups
он возвращает ноль.
int _tmain(int argc, _TCHAR* argv[])
{
CAtlRegExp<> reUrl;
// Five match groups: scheme, authority, path, query, fragment
REParseError status = reUrl.Parse(**L"[^\",]+|(?:[ˆ\"])|\"\")"**);
if (REPARSE_ERROR_OK != status)
{
// Unexpected error.
return 0;
}
TCHAR testing[ ] = L"It’ s \" 10 Grand\" , baby";
CAtlREMatchContext<> mcUrl;
if (!reUrl.Match(testing,&mcUrl))
{
// Unexpected error.
return 0;
}
for (UINT nGroupIndex = 0; nGroupIndex < mcUrl.m_uNumGroups;nGroupIndex)
{
const CAtlREMatchContext<>::RECHAR* szStart = 0;
const CAtlREMatchContext<>::RECHAR* szEnd = 0;
mcUrl.GetMatch(nGroupIndex, &szStart, &szEnd);
ptrdiff_t nLength = szEnd - szStart;
printf_s("%d: \"%.*s\"\n", nGroupIndex, nLength, szStart);
}
return 0;;
}