VC有没有与LINUX的regex.h对应的库?

zyq_123 2012-04-12 11:35:17
VC有没有与LINUX的regex.h对应的库?
...全文
392 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
donet88 2012-04-13
  • 打赏
  • 举报
回复
VC2010已经支持了C++11的<regex>

http://en.wikipedia.org/wiki/C%2B%2B11


const char *reg_esp = "[ ,.\\t\\n;:]"; // List of separator characters.

// this can be done using raw string literals:
// const char *reg_esp = R"([ ,.\t\n;:])";

std::regex rgx(reg_esp); // 'regex' is an instance of the template class
// 'basic_regex' with argument of type 'char'.
std::cmatch match; // 'cmatch' is an instance of the template class
// 'match_results' with argument of type 'const char *'.
const char *target = "Unseen University - Ankh-Morpork";

// Identifies all words of 'target' separated by characters of 'reg_esp'.
if( std::regex_search( target, match, rgx ) ) {
// If words separated by specified characters are present.

const size_t n = match.size();
for( size_t a = 0; a < n; a++ ) {
std::string str( match[a].first, match[a].second );
std::cout << str << "\n";
}
}
evencoming 2012-04-13
  • 打赏
  • 举报
回复
正则库,我直接用 的pcre.h
windows下.
zyq_123 2012-04-13
  • 打赏
  • 举报
回复
引用 1 楼 的回复:

正则库,我直接用 的pcre.h
windows下.



pcre.h能直接在VC里面用吗?

3
dreamcs 2012-04-13
  • 打赏
  • 举报
回复
http://blog.csdn.net/dreamcs/article/details/6698655
使用tr1
卡卡_苏米 2012-04-13
  • 打赏
  • 举报
回复
下下来 编译一下就行了 我的环境是VS08 和VS10都行
卡卡_苏米 2012-04-13
  • 打赏
  • 举报
回复
推荐boost库 里面有正则库 而且有很多有用的库,在windows下能用~~
zyq_123 2012-04-13
  • 打赏
  • 举报
回复

引用 1 楼 的回复:

正则库,我直接用 的pcre.h
windows下.



pcre.h能直接在VC里面用吗?

2
hoya5121 2012-04-13
  • 打赏
  • 举报
回复
ATL 有正则表达式的库
zyq_123 2012-04-13
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]

正则库,我直接用 的pcre.h
windows下.
[/Quote]

pcre.h能直接在VC里面用吗?

64,682

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧