65,208
社区成员
发帖
与我相关
我的任务
分享#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main()
{
string strText("百度:http://www.baidu.com\r\n谷歌:http://www.google.com");
regex strRegex("([a-z].*)");
cmatch mat;
bool a = regex_match(strText.c_str(), mat, strRegex);
cmatch::iterator itr = mat.begin();
for (; itr != mat.end(); ++itr)
{
cout << itr->first - strText.c_str() << ' ' << itr->second - strText.c_str() << ' ' << *itr << endl;
}
return 0;
}