Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-02-05 13:36:59


Hi,

Currently I have the following string:

"test anothertest somethinelse skillholder"

I'm trying to create a regex that will match each word. For example, the
following regex:

(\w+)

will match each word. However, boost::xpressive::regex_search() stops at the
first substring match. I'm looking for a way to make it continue to find
matches until the end of the string is met. So when I review the matches at
the end of the search, it will have 4 matches, each match representing one
word in the string above.

The C++ code is below. Note that I only get "test" in my results back, when
I expected 3 other words to be in the matches. Can anyone tell me how to
make it continue the search beyond the first match? Thank you.

std::string classes = "test anothertest somethinelse skillholder";
using namespace boost::xpressive;

sregex rex = sregex::compile( "(\\w+)" );
smatch matches;

regex_search( classes, matches, rex );



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