与Boost Xpressive不区分大小写匹配
Case-insensitive match with Boost Xpressive
我就是无法获得regex_match
函数来查找不区分大小写的匹配。尽管定义了boost::xpressive::regex_constants::icase
并且我使用了强制转换(因此Xpressive的icase
方法没有歧义),但我还是得到了编译错误(VS2010):
错误C2440:"type cast":无法从"const-boost::expression::detail::modifier_op"转换为"boost::expression::regex_constants::match_flag_type"
一些要复制的代码:
#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;
}
你知道问题出在哪里吗?
尝试使用
boost::xpressive::sregex re = boost::xpressive::sregex_compiler().
compile("foo", boost::xpressive::icase);
syntax_options_type
(即boost::xpressive::regex_constants::icase_
)不是match_flag_type
(regex_match
的3个参数应具有此类型)。
相关文章:
- 使字母检查不区分大小写
- 如何执行不区分大小写的字符串比较?
- 函数中的切换大小写语句不会切换C++
- CMake 添加不区分大小写的源文件
- 提升program_option配置文件的不区分大小写的解析
- 如何提升Perl正则表达式匹配,支持区分大小写/不区分大小写
- 对字符串向量进行排序,但不区分大小写
- 比较最后一个字符,不区分大小写(带谓词?
- 如何创建一个程序来标识最长的子字符串回文,而不考虑字母大小写
- C Visual Studio代码不使用工作区中的单个文件夹编译
- 如何在交换机中将一个枚举值标记为不适当的大小写
- 在字符串的 boost::unordered_set 中使用 Lambda 函数 - 不区分大小写
- 程序在我的C++工作区中找不到头文件
- 开关大小写不调用其中的函数
- 为什么不区分大小写适用于 std::unordered_set的 std::hash 函数?
- 为什么我的代码在开关大小写中不起作用
- 比较字符串大小写不区分的简单方法是什么?
- 如何使字符串中的每个字母不区分大小写
- 不区分大小写的字符串
- Qt:如何在大小写不敏感模式下减去QString的两个QSet