
20 May
2010
20 May
'10
12:02 p.m.
Is this the correct way to validate a regex expression? bool validateExpression(std::string e) { using namespace boost; return !expression.empty() && !regex(e, regex_constants::no_except).empty(); } This passes all of my existing unit tests except for the following strings which boost::regex reports as valid. "[[[A-Z]]" "[A-Z]??" Both Qt's QRegExp and http://www.regexplanet.com/simple/index.html report the first is invalid. Qt's QRegExp reports the second as invalid, while http://www.regexplanet.com/simple/index.html report it as valid. Is boost::regex right or remiss? Is there a better on line regex validator? Thanks, Jeff