Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-08-10 04:49:56


Winson Yung wrote:
>> 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;

                                                 Error here:^

The last arg to the iterator constructor is optional, and should be one or
more of the match_flag enum's:
http://www.boost.org/libs/regex/doc/match_flag_type.html

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net