Boost logo

Boost :

From: Anne Martens (mail_at_[hidden])
Date: 2006-04-03 11:35:33


Hi,

I'm trying to use boost-regex in my project that doesn't support
exceptions. Thus, when constructing a regular expression with
boost::regex expression(expr); and passig an invalid regular expression,
my program crashes.

What can I do to make sure my regular expression is valid before passing
it to exception-throwing methods like that one?

I already found an older answer that seems to apply to my problem
(http://lists.boost.org/Archives/boost/2002/11/39161.php), it is
suggested to use the member function set_expression. But how do I do
that? I only get a lot of compiler errors.

I have the regular expression as a std::string, so I'd like to write
something like

//string expr holds the regular expression

boost::regex expression();
int result = expression.set_expression(expr);

//check whether result is 0 -> ok.

Thanks in advance for your help!

Best regards,
Anne Martens


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk