如何boost::regex_search
在 C++ 中使用忽略大小写标志或常量?
请发布一个简单的示例。
谢谢!
你需要这样的东西
boost::regex regex("your expression here", boost::regex::icase);
boost::smatch what;
string mystring;
bool search_result = boost::regex_search(mystring.begin(),mystring.end(), what, regex);
或类似的东西(没有设置boost::regex::icase
):
boost::regex regex("(?i)expression");
boost::smatch what;
string mystring;
bool search_result = boost::regex_search(mystring.begin(),mystring.end(), what, regex);