Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2008-08-11 13:22:14


gj_uestc wrote:
>> Hi all,
>> I got another problem here while trying using boost:regex:
>> does boost:regex support char set substraction?
>>
>> For example:I give boost:regex an expression"[a-z]-[d-f]".I would
>> like the boost take the second "-" as and substracion. So this
>> expression is supposed to be translated as "[a-c]|[f-z]".I am
>> wonderring whether boost:regex has such substraction symbols?

No, but you can simulate subtraction with lookahead/lookbehind, for example:

subtraction: (?=[a-z])[^d-f]
Intersection: (?=[a-z])[d-f]

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