Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.regex expression construction
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-03-11 11:45:19


Eric J. Holtman wrote:
> Shaolin wrote:
> > Hello Gevorg,
> >
> > An example string: (4+1)*2 - I want to return true if the parentheses are
> found and false if there are none or there is a partial match ( e.g. (2+2+1 will
> return false because there is only one parenthese and hence the equation is
> incomplete).
> >
>
> You can't really do parathesis matching with regular expressions.

True, if there can be nesting of parentheses. Otherwise, you can search for parenthesized non-empty sub-expressions with "\\([^\\(\\)]+\\)"

Regards,
Gevorg


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