title: Can you use Boost.Regex to parse a stream?
body: <p>I was playing around with Boost.Regex to parse strings for words and numbers. This is what I have so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;boost/foreach.hpp&gt;
  #include &lt;boost/regex.hpp&gt;
  #include &lt;boost/range.hpp&gt;
  
  using namespace std;
  using namespace boost;
  
  int main()
  {
      regex re
      (
          "("
              "([a-z]+)|"
              "(-?[0-9]+(\\.[0-9]+)?)"
          ")"
      );
  
      string s = "here is a\t list of Words. and some 1239.32 numbers to 3323 parse.";
      sregex_iterator m1(s.begin(), s.end(), re), m2;
  
      BOOST_FOREACH (const match_results&lt;string::const_iterator&gt;&amp; what, make_iterator_range(m1, m2)) {
          cout &lt;&lt; ":" &lt;&lt; what[1].str() &lt;&lt; ":" &lt;&lt; what.position(1) &lt;&lt; ":" &lt;&lt; what.length(1) &lt;&lt; endl;
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Is there a way to tell regex to parse from a stream rather than a string? It seems like it should be possible to use any iterator.</p>