C++11中正则表达式测试
来源:互联网 发布:centos网络配置命令 编辑:程序博客网 时间:2024/05/17 22:45
VC++2010已经支持regex了, 可以用来编译下述代码.
#include <string>#include <regex>#include <iostream>using namespace std;/* 测试C++11中的正则表达式. */int main(){ //定义正则表达式,匹配时间格式 regex testRegex("[0-9]{2}:[0-9]{2}:[0-9]{2}\\.[0-9]{3}"); //要匹配的字符串 string strText("OTA LOG SFTCH/MPA Stream 2/Reservation Accept 07:23:50.580 Channel: 147, Pilot PN: 232"); cmatch result; //结果 //search 是匹配子字符串, match 是匹配整个字符串 if (regex_search(strText.c_str(), result, testRegex, regex_constants::format_default)) { cout << result.str() << endl; } else { cout << "fail." << endl; }}
- C++11中正则表达式测试
- C中运用正则表达式
- C中使用正则表达式
- java中使用正则表达式:测试模式
- linux C正则表达式——POSIX正则测试
- 在c语言中使用正则表达式
- c语言中使用正则表达式
- C/C++中使用正则表达式
- C语言中使用正则表达式
- linux C 中使用正则表达式
- 在C中支持正则表达式
- C语言中利用PCRE正则表达式
- object C 中使用正则表达式
- object C 中使用正则表达式
- C语言中嵌入正则表达式
- C语言中嵌入正则表达式
- C语言中使用正则表达式
- C语言中嵌入正则表达式
- jvm区域
- 产能利用率 (Capacity Utilization)
- JAVA设计模式十四--Visitor(访问者模式)
- 并发
- lease机制
- C++11中正则表达式测试
- 线程交互
- 昨晚上闭路电视没信号了
- 关于ubuntu和win7双系统使用的问题
- 模版文件 2440INIT.S
- Set实现元音统计小程序
- 异常:Invocation of com.google.gwt.user.tools.WebAppCreator failed. See the error log for more details
- VC/MFC结束程序进程时删除程序系统托盘中的图标
- [线段树+离散化]LightOJ 1089 - Points in Segments (II)