
OK, so I want to use the sregex_token_iterator functionality to split a data string. The data string contains: /a/b//c/ The delimiter is the forward slash and I do want empty strings. I expect to get: {}{a}{b}{}{c}{} What I actually get is: {}{a}{b}{}{c} The empty string after {c}, which I expect because the data string ended in a forward slash, is missing. What do I have to do to get the empty string after {c} if the data string ends in a forward slash? The code is as follows: --- #include <iostream> #include <string> #include <boost/xpressive/xpressive.hpp> #include <boost/xpressive/regex_token_iterator.hpp> int main(int argc, char *argv[]) { // Split the path using namespace boost::xpressive; // For simplicity sregex levelSplitter(as_xpr('/')); std::string nodePath("/a/b//c/"); sregex_token_iterator begin(nodePath.begin(),nodePath.end(),levelSplitter,-1); sregex_token_iterator end; for (sregex_token_iterator iCur=begin;iCur!=end;++iCur) std::cout << '{' << *iCur << '}'; std::cout << std::endl; return 0; } --- Thanks, Michael Goldshteyn