
5 Apr
2008
5 Apr
'08
3:36 p.m.
gast128 wrote:
and another one: the regex::ECMAScript has value 0, so it can not be tested for in the following way:
void show_flags(const std::tr1::regex& rrgx) { if ((rrgx.flags() & std::tr1::regex::ECMAScript) == std::tr1::regex::ECMAScript) { //always true, since it has value 0 } }
The value of zero is intentional: it was something that users were asking for and ensures that: regex e("text", perl|icase); and regex e("text, icase); are equivalent (perl and ECMAScript expressions are treated the same in Boost.Regex). If you really want to extract out the regular expression "type" then use: (e.flags() & (ECMAScript|basic|extended|awk|grep|egrep)) == ECMAScript HTH, John.