|
Boost Users : |
From: John Maddock (john_at_[hidden])
Date: 2006-08-09 12:23:08
gast128 wrote:
> Let's leave the actual case, but take the example of having input
> which has different combinations for each caracter. One can make
> strings for each of this case, but this explodes of course the number
> of combinations.
>
> So suppose I still have a string like a[a,b][a,c] representing all
> cases of this string. Now suppose regex_match is going to match this
> with (a|b)*. I can imagine that it in the end it will call something
> like if (*it == 'a'). This is the equality operator called for the
> type the iterator is pointing to.
>
> thus e.g.
>
> struct multiple_string
> {
> typedef std::string char_type;
>
> std::vector<std::string> m_Data;
> };
>
>
> bool operator==(char_type k1, multiple_string::char_type k2)
> {
> //etc...
> }
>
> Now the whole question was, how do I hget something like this
> compilable with boost regex. I see that it has overloads for icu and
> MFC string, but these always seems to be character based.
>
> Put it in another way, is boost regex biased towards string types, or
> supports it a generic interface.
It works on iterators, and on comparisons between characters.
You could define your own traits class so that say: a character 'a' in your
regex would always match any of [abc] in the string. But you can't match a
regex against a regex which seems to be what you're asking for. As has been
said already that's a much harder problem.
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