boost库学习及应用
来源:互联网 发布:java爬虫代码视频教程 编辑:程序博客网 时间:2024/06/06 07:16
第1章 boost 正则表达式
需要下载最新boost库,编译。 我是在vs2013里使用boost_1_60_0,前提步骤:
(1)需要在项目属性-》C/C++-》常规-》附加包含目录 里添加 XX/boost_1_60_0 ;
(2)需要在链接器-》常规-》附加库目录 里添加D:\tools\boost_1_60_0\libs 和D:\tools\boost_1_60_0\stage\lib
1.regex 匹配字符串 简单使用
.头文件#include<boost/regex.hpp>
string patstr="samsung";
boost::regex re("SAMSUNG|三星",boost::regex::icase | boost::regex::perl);
boost::smatch mat;
bool bRet = boost::regex_search(patstr,mat,re);
if(bRet == true)
{
// to do (匹配成功)
}
注:
boost::regex::icase/boost::regex::perl是标志开关,表示忽略大小写。可以把需要的标志开关打开,不需要时默认关闭。
patstr,mat,re的类型如下:
str类型
m类型
re类型
string
smatch (match_results<string::const_iterator>)
regex (basic_regex<char>)
wstring
wsmatch (match_results<wstring::const_iterator>)
wregex (basic_regex<wchar_t>)
char*
cmatch (match_results<const char*>)
regex (basic_regex<char>)
wchar_t*
wcmatch (match_results<const wchar_t*>)
wregex (basic_regex<wchar_t>)
- boost库学习及应用
- boost学习与应用笔记之一:Boost.Atomic
- boost库学习
- boost 库学习
- Boost库学习
- boost库学习笔记
- Boost线程库学习
- boost库学习总结
- boost库学习笔记
- boost库学习笔记
- Boost库学习----timer
- Boost库学习------progress_timer
- boost-timer库学习
- boost库学习笔记
- 学习boost库手册
- boost库学习总结
- boost库学习笔记
- boost库学习
- 变形空间和候选消除算法(Candidate-Elimination)C++实现
- C语言变参使用
- mysql的utf8mb4设置
- Shell脚本中参数传递方法常用有8种
- linux redis安装
- boost库学习及应用
- 树莓派使用360wifi2实现无线上网
- 最坏情况下,找到n个元素中第二小的元素需要(n-1)+(lgn向上取整+1)
- C语言:运行中获取宏名字的技巧
- 指针理解
- 如何返回一个二维数组
- makefile的调试
- 关于正手拉前冲弧圈球和加转弧圈球的几点领悟
- iBatis简单入门教程