Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit-general] Pattern matching with boost
From: Anthony Foiani (tkil_at_[hidden])
Date: 2011-11-09 23:33:32


Alec Taylor <alec.taylor6_at_[hidden]> writes:

> Would it be possible to abstract away the terms "apple" and "cheese"
> to just equal anything with that pattern?
>
> So like this:
>
> s1=name1-> consecutive-number
> s2= consecutive-number->name2
> s3=name1->consecutive-number
> s4=consecutive-number->name2

Just what pattern do you mean, though? You've used "name" and
"string1". Is there a character class or other short regexp that
would match what you mean by "name" below?

And do you already have the 4 strings, or are you scanning a
continuous piece of text? If the latter, you're suddenly in the realm
of wanting a state machine (because if s4 fails to match, then might
have to consider s3 the new s1 and s4 the new s2...)

Is "consecutive" only within the 4 strings, or is it actually
cumulative from some other value? (This is a big part of what makes
this difficult to do with boost or any other C/C++-based RE engine.
Perl allows one to actually do evaluation within the search string, so
you really could match this all with a single RE there -- but it'd be
ugly, and I don't really know how efficient it would be.)

Curious,
T.


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