This is rather a quick question, I just couldn't find it in the boost documentation nor any other boost regex examples/tutorials.
Suppose I want to tokenize a string using this implementation:
boost::regex re("[\\sXY]+");
std::string s;
while (std::getline(std::cin, s)) {
boost::sregex_token_iterator i(s.begin(), s.end(), re, -1);
boost::sregex_token_iterator j;
while (i != j) {
std::cout << *i++ << " ";
}
std::cout << std::endl;
}
The problem is that the delimiter expression won't be iterated. I also need the delimiter string. How can I make sure of this?