Reputation: 7370
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?
Upvotes: 0
Views: 431
Reputation: 55887
Try to use
boost::xpressive::sregex re = boost::xpressive::sregex_compiler().
compile("foo", boost::xpressive::icase);
syntax_options_type
(that is boost::xpressive::regex_constants::icase_
) is not match_flag_type
(3 argument for regex_match
should have this type).
Upvotes: 2