Boost logo

Boost Users :

From: Nat Goodspeed (nat_at_[hidden])
Date: 2008-03-06 10:51:40


Boris wrote:
> On Tue, 26 Feb 2008 22:37:19 +0200, <office_at_[hidden]> wrote:
>
>> [...]I tried starting with a pattern like (C++ syntax for strings)
>>
>> ^(?:(<|<=|>|>=|=|<>){1}((?:-|\\+)?[0-9]+(?:\\.[0-9]+|\\,[0-9]+)?))?(?:\\s*)(?:(\\[FG:(?:BLUE|RED|GREEN|BLACK|YELLOW|WHITE|CYAN|NONE)\\])|(\\[BG:(?:BLUE|RED|GREEN|BLACK|YELLOW|WHITE|CYAN)\\])|(\\[FG:(?:BBLUE|RED|GREEN|BLACK|YELLOW|WHITE|CYAN|NONE)\\])(?:\\s*)(\\[BG:(?:BLUE|RED|GREEN|BLACK|YELLOW|WHITE|CYAN)\\])){1}$
>>
>> But this does not allow the [fg:][bg:] terms to be interchanged and also
>> when a new color or style will be added to the format class I have to
>> change the pattern three times. I tried backward references with no
>> success.
>
> If regular expressions get as big as this and maybe even more complicated
> you might want to use Boost.Spirit instead. Boost.Spirit is not as easy to
> use as Boost.Regex but complicated expressions are broken down to
> something more easily understandable.

I second that suggestion. Any time input elements are not merely
optional but order-insensitive, I start thinking "parser" rather than
"regular expression."


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