regex_search 函数
来源:互联网 发布:mac os 无法更新 编辑:程序博客网 时间:2024/06/07 10:59
// std_tr1__regex__regex_search.cpp // compile with: /EHsc #include <regex> #include <iostream> int main() { const char *first = "abcd"; const char *last = first + strlen(first); std::cmatch mr; std::regex rx("abc"); std::regex_constants::match_flag_type fl = std::regex_constants::match_default; std::cout << "search(f, f+1, \"abc\") == " << std::boolalpha << regex_search(first, first + 1, rx, fl) << std::endl; std::cout << "search(f, l, \"abc\") == " << std::boolalpha << regex_search(first, last, mr, rx) << std::endl; std::cout << " matched: \"" << mr.str() << "\"" << std::endl; std::cout << "search(\"a\", \"abc\") == " << std::boolalpha << regex_search("a", rx) << std::endl; std::cout << "search(\"xabcd\", \"abc\") == " << std::boolalpha << regex_search("xabcd", mr, rx) << std::endl; std::cout << " matched: \"" << mr.str() << "\"" << std::endl; std::cout << "search(string, \"abc\") == " << std::boolalpha << regex_search(std::string("a"), rx) << std::endl; std::string str("abcabc"); std::match_results<std::string::const_iterator> mr2; std::cout << "search(string, \"abc\") == " << std::boolalpha << regex_search(str, mr2, rx) << std::endl; std::cout << " matched: \"" << mr2.str() << "\"" << std::endl; return (0); }
<span id="mt18" class="sentence" data-guid="e952de1597758af8c64a8fc50a99280d" data-source="" search(f,="" f+1,="" "abc")="=" false"="" xml:space="preserve">搜索 (a、f+1,“abc ==) 的错误搜索 (a、、,“abc true ==) 匹配:“abc”错误 (搜索“a”,“abc 的 ==)true (搜索“xabcd”,“abc 的 ==) 匹配:“abc”错误搜索 (字符串,“abc 的 ==)true 搜索 (字符串,“abc 的 ==) 匹配:“abc
0 0
- regex_search 函数
- boost库中函数regex_search()
- regex_search()和getline(cin,str)函数,以及对其中正则表达式的解释
- 使用boost::regex_search进行字符串提取
- regex_search 找到字串所有匹配 类似/g
- 使用Boost Regex 的regex_search进行遍历搜索
- 如何在使用了BOOST_REGEX_MATCH_EXTRA情况下提高boost::regex_search的执行速度
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 严重: Exception loading sessions from persistent storage
- SPring+Structs2实现的项目中进行Spring AOP时的相关小记
- Kindergarten - CodeForces 484 D dp
- ubuntu 14.04 下 Matlab 2013b 中文乱码问题
- IE browser use URL to login web site
- regex_search 函数
- IOS开发搜索和排序(好友列表 通讯录的实现 searchbar)
- hdu 2149 Public Sale
- 第11周项目2-2 求四数的最大公约数。
- Selenium2.0 Webdriver - Element can be click when out of view
- 使用 UIBezierPath+CAShapeLayer 实现不在View层绘制自定义图形
- 共用体
- Selenium RC keypress
- 关于SSH框架设计的一些理解