Boost logo

Boost :

Subject: [boost] [algorithm][string] regex_finder examples
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-10-17 12:39:30


I noticed that there are no examples for using regex_finder with
find_iterator. I checked the test & example directories in libs, and also
the documentation. I found nothing useful. Could someone provide a quick
example? So far here is what I have, but it does not compile:

*#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string_regex.hpp>
#include <boost/regex.hpp>

int main()
    std::string queryKey = "/foo/bar//stuff/";

    boost::find_iterator<std::string::iterator> keyIt( queryKey,
boost::regex_finder( boost::regex( "/.*?" ) ) );
    boost::find_iterator<std::string::iterator> end;

    for( ; keyIt != end; ++keyIt )

        std::cout << "\"" << *keyIt << "\"\t" << (*keyIt).size() <<

    std::cout << std::endl;
    system( "pause" );
    return 0;

Boost list run by bdawes at, gregod at, cpdaniel at, john at