65,210
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <stdlib.h>
#include <boost/regex.hpp>
#include <string>
#include <iostream>
using namespace std;
using namespace boost;
regex expression("http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?");
int main(int argc, char* argv[])
{
char sHtmlBuff[20*1024];
FILE *fp;
fp = fopen("c:\\tomore.htm","rb");
fread(sHtmlBuff,1,sizeof(sHtmlBuff),fp);
fclose(fp);
cmatch what;
cout << "enter test string" << endl;
//getline(cin,in);
if(regex_match(sHtmlBuff, what, expression))
{
for(int i=0;i<what.size();i++)
cout<<"str :"<<what[i].str()<<endl;
}
else
{
cout<<"Error Input"<<endl;
}
return 0;
}