
20 May
2010
20 May
'10
1:39 p.m.
John Maddock wrote:
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?
They're both accepted by Perl-5.10 and hence by Boost.Regex.
HTH, John.
Thanks again John, Jeff