On Thursday 07 November 2002 2:01 pm, Lars Gullik Bjønnes wrote:
> > Is it any way to check that a regex is valid?
> > (when not using exceptions)
> >
> > boost::regex e("a(");
> >
> > works fine... but when used app crashes.
>
> It's not actually documented, but use the set_expression member function
> and check to see if the return value is zero (expression compiled OK), or
> not.

Ok, thanks Lars. I added this to my RegexMatch functor and use it before 
searching with find_if.

        bool validRE() const { return regex_.error_code() == 0; }

Angus

Reply via email to