Comment 3 for bug 1414362

Revision history for this message
cologic (cologic) wrote :

std::regex doesn't support the Perl mode modifiers such as (?i). It is, in fact, a valid RE.

http://www.boost.org/doc/libs/1_57_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html describes how the"Perl regular expression syntax is based on that used by the programming language Perl . Perl regular expressions are the default behavior in Boost.Regex". However, by contrast, http://www.cplusplus.com/reference/regex/regex_constants/#syntax_option_type lists only ECMAScript, basic, extended, awk, grep, and egrep-type REs, of which ECMAScript has been chosen as default.

http://www.regular-expressions.info/stdregex.html summarize the differences between these RE syntaxes; none of them, however, support the Perl-inspired case insensitivity mode modifiers such as LoRenZo uses. http://www.regular-expressions.info/javascript.html in particular notes that the syntax which std::regex implements by default, "JavaScript implements Perl-style regular expressions. However, it lacks quite a number of advanced features available in Perl and other modern regular expression flavors" such as "mode modifiers to set matching options within the regular expression".

It looks like if one wants to keep allowing (?i) and similar mode modifiers -- and convenient case insensitivity is pretty useful -- then reverting to boost::regex would make sense.