Boost logo

Boost Users :

From: Jean-Sebastien Vachon (js.vachon_at_[hidden])
Date: 2006-04-05 15:41:27


Hi All,

I have a string in the following form:

w="id = 10" C=field1 G=GeoRaster X=leMHG08wViX2quWNB

All I want is to iterator onto the key/values pairs.

w
"id = 10"
C
field1
G
GeoRaster
X
leMHG08wViX2quWNB

The key/value pairs are separated by spaces. However, I can not
simply use a space pattern to iterate over my input string since the
W option allows the user to use "" to include spaces.

Can someone tell me what is wrong in the following code?
oParametersValue represents my input string.

 regex eParam("(.)=(\"?.*\"?)", regex::normal | regbase::icase);

 int const sub_matches[] = { 1, 2 }; // key, value

 sregex_token_iterator oIter(oParametersValue.begin(),
                            oParametersValue.end(), eParam,
                            sub_matches);

 sregex_token_iterator j;
 while (oIter != j)
 {
    std::cout << *oIter++ << std::endl;
 }

Thanks


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