10 Aug
2006
10 Aug
'06
2:18 a.m.
Hi all, I am trying to use cregex_iterator, but reading the doc doesn't seem to help me understand the usage of the API. If I supply a regular expression, is the following code correctly get the starting position of each occurance of the string "hello world here" in the buffer? sample code like this: int nextPos[100]; char *pBuf = NULL; // pBuf will be point to a buffer NULL terminated ............................ regex expr("hello world here", regex_constants::perl | regex_constants::icase); cregex_iterator h1(pBuf, pBuf + std::strlen(pBuf), expr, 1), h2; int i = 0; while (i < 100 && h1 != h2) { nextPos[i] = (*h1).position(0); h1++; i++; }