Boost logo

Boost Users :

Subject: Re: [Boost-users] Running Regular expression (RE) over a list, array or map
From: Jeff Flinn (jeffrey.flinn_at_[hidden])
Date: 2013-09-26 14:58:36


On 9/26/2013 12:02 PM, John Maddock wrote:
>> I am wondering if it is possible to run directly regular expression
>> over a
>> list and getting the indexes (begging and end) of the match. For
>> example, I
>> have a list of strings and a regular expression and I want to know which
>> part of the list matches the RE and get the corresponding indexes in the
>> list. Any suggestion is welcome. Thank you.
...
> 2) Write a composite iterator which enumerates single characters over
> the whole collection of strings and pass that to the regex algorithms,
> in fact I can't believe we don't have this already in Boost, but it
> appears not :-(

Perhaps boost::range::join would work something like:

std::string s1, s2;

auto r12 = boost::join(s1, s2);

...regex...(...begin(r12), end(r12)...)

at least for a list of size 2.

Jeff


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