Boost logo

Boost Users :

Subject: Re: [Boost-users] Running Regular expression (RE) over a list, array or map
From: John Maddock (john_at_[hidden])
Date: 2013-09-26 12:02:16


> 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.

You have two options:

1) Use the partial match option to search each item in the collection in
turn, and then "do something" if regex indicates that there may be a match
that spans two items in the collection.
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 :-(

HTH, John.


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