I just can't get the regex_match
function to find case-insensitive matches. Even though boost::xpressive::regex_constants::icase
is defined and I use a cast (so there is no ambiguity to the icase
method of Xpressive), I get a compilation error (VS2010):
error C2440: 'type cast' : cannot convert from 'const boost::xpressive::detail::modifier_op' to 'boost::xpressive::regex_constants::match_flag_type'
Some code to reproduce:
#include <stdio.h>
#include <boost/xpressive/xpressive.hpp>
int main(){
std::string str("FOO");
boost::xpressive::sregex re = boost::xpressive::sregex_compiler().compile("foo");
bool result = regex_match(str,re,(boost::xpressive::regex_constants::match_flag_type)boost::xpressive::regex_constants::icase);
if(result){
std::cout << "Match!";
}else{
std::cout << "No match!";
}
return 0;
}
Do you know what the problem might be?
Try to use
syntax_options_type
(that isboost::xpressive::regex_constants::icase_
) is notmatch_flag_type
(3 argument forregex_match
should have this type).