Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 118397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:29:18+00:00 2026-05-11T03:29:18+00:00

I was playing around with Boost.Regex to parse strings for words and numbers. This

  • 0

I was playing around with Boost.Regex to parse strings for words and numbers. This is what I have so far:

#include <iostream> #include <string> #include <boost/foreach.hpp> #include <boost/regex.hpp> #include <boost/range.hpp>  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<string::const_iterator>& what, make_iterator_range(m1, m2)) {         cout << ':' << what[1].str() << ':' << what.position(1) << ':' << what.length(1) << endl;     }      return 0; } 

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:29:18+00:00Added an answer on May 11, 2026 at 3:29 am

    Boost.IOStreams has a regex_filter allowing one to perform the equivalent of a regex_replace on a stream. However, looking at the implementation, it seems to ‘cheat’ in that it simply loads the whole stream into a buffer and then calls Boost.Regex on that buffer.

    Making a regex search on a stream’s contents without having to entirely load it in memory can be done with the ‘partial match‘ support of Boost.Regex. Look at the example at the end of the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While playing around with regexps in Scala I wrote something like this: scala> val
I am playing around with MVC and have started setting up an existing site
I've been playing around with boost threads today as a learning exercise, and I've
Good evening :) I'm playing around with g++ and makefiles. I've gotten to this
So, I've been playing around with the Boost asio functions and sockets (specifically the
I was playing around with variadic templates (gcc 4.5) and hit this problem :
Playing around with Google Maps these days, with some directions. I have a map
Started playing around with jQuery and the jsTree plugin yesterday, and have it successfully
I have been playing around with the dynamic abilities of powershell and I was
I have been playing around with the concept of 'module' that some mvc frameworks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.