Boost logo

Boost Users :

Subject: Re: [Boost-users] regex
From: Dejan (xamiw_at_[hidden])
Date: 2009-12-14 07:58:10


> How about (caution, untested, off the top of my head!):
>
> #include <string>
> #include <iostream>
> #include <boost/regex.hpp>
>
> int
> main()
> {
> std::string s("s0,s1,s2");
> boost::regex re("\\s*(s[0-9])\\s*(?:,\\s*)?");
>
> // 1. attempt
> boost::sregex_token_iterator i(s.begin(), s.end(), re, 1), j;
> while(i!=j)
> {
> std::cout << *i++ << std::endl;
> }
> }
>
> HTH, John.

Thanks, that solved my problem.


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