|
Boost Users : |
From: Lynn Allan (l_d_allan_at_[hidden])
Date: 2007-01-25 08:42:11
I want to use boost::regex 1.33.1 and vc7.1 on a WinXp-Sp2 computer to
remove common words from a file. I'm encountering a problem which
seems related to having two of the common words next to each other.
std::string test(" in the beginning god created the heavens and the
earth ");
boost::regex reg;
reg.assign("( and | can | did | the | in | a )");
test = boost::regex_replace(test, reg, " ");
cout << test << endl;
The result is:
" the beginning god created heavens the earth "
Am I doing something wrong or leaving out a step? Seems like the above
ought to work. It catches one of the occurrences of " the " between "
created " and " heavens " but not those immediately after the " in "
or " and ".
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