Look up the documentation for TR1 regexes or (almost equivalently) boost regex. Both work quite nicely on various Unix systems. The TR1 regex classes have been accepted into C++ 0x, so though they're not exactly part of the standard yet, they will be reasonably soon.
Edit: To break a string into subgroups, you can use an sregex_token_iterator. You can specify either what you want matched as tokens, or what you want matched as separators. Here's a quickie demo of both:
#include <iterator>
#include <regex>
#include <string>
#include <iostream>
int main() {
std::string line;
std::cout << "Please enter some words: " << std::flush;
std::getline(std::cin, line);
std::tr1::regex r("[ .,:;\\t\\n]+");
std::tr1::regex w("[A-Za-z]+");
std::cout << "Matching words:\n";
std::copy(std::tr1::sregex_token_iterator(line.begin(), line.end(), w),
std::tr1::sregex_token_iterator(),
std::ostream_iterator<std::string>(std::cout, "\n"));
std::cout << "\nMatching separators:\n";
std::copy(std::tr1::sregex_token_iterator(line.begin(), line.end(), r, -1),
std::tr1::sregex_token_iterator(),
std::ostream_iterator<std::string>(std::cout, "\n"));
return 0;
}
If you give it input like this: "This is some 999 text", the result is like this:
Matching words:
This
is
some
text
Matching separators:
This
is
some
999
text