From: Anne Martens (mail_at_[hidden])
Date: 2006-04-03 11:35:33
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
//string expr holds the regular expression
int result = expression.set_expression(expr);
//check whether result is 0 -> ok.
Thanks in advance for your help!