Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-04-08 05:35:58


> Just seemed that at the point when the code sets
> mySmatch[curIndex].matched to true, then it could "tuck away" that
> index in an accessible variable .... but apparently not.

No it has to maintain a stack of all past values, in order to backtrack out
of a match.

> Any suggestions about alternative on how to best accomplish the
> search for Bible verse references? I'd have to think the participants
> in this thread would have some deep insights on the best way to
> proceed.

This is a deep insight free zone :-)

If you just want the first index to have matched then simply a linear search
is as good as anything:

int lowest_match = 1;
for(; lowest_match < mymatch.size(); ++lowest_match)
    if(mymatch[lowest_match].matched) break;

which assumes that your regex is along the lines of:

(a)|(b)|(c)|...

If that turns out too slow, then you might then have to collect together
common prefixes for some of the expressions into single alternatives, but
I'm not knowledgeable on bible references.

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