try {
using namespace boost::xpressive;
string data = "abc cde ac af aa jaskfh";
sregex reg = sregex::compile("\\S+");
sregex reptitle = sregex::compile(".*50x$");
sregex replocal = sregex::compile("127.0.0.1.*?\\n");
string handleData = regex_replace(response, reptitle, "");
handleData = regex_replace(handleData, replocal, "");
cout << "new: " << handleData << endl;
sregex_iterator pos(handleData.begin(), handleData.end(), reg);
sregex_iterator end;
for (; pos != end; ++pos) {
//cout << "pos: " << (*pos)[0] << endl;
}
}
}
catch (std::exception& e) {
cout << e.what() << endl;
}
te = "djs988.cn 287 350599 1384188 2871431 181 106 0 0\n"\
"www.yhht16.net.cn 507 167785 808399 695227 507 0 0 0\n"\
"127.0.0.1 10 1952 3964 0 1 0 0 0\n"\
"yh6688.com.cn 140 14256 1991755 828158 23 117 0 0\n"\
"ego111.net.cn 5 537 1306 305 5 0 0 0\n"\
"yh6688.cn 54 10766 5613108 3894 44 10 0 0\n"\
"www.yseg.com.cn 3 1004 1769 1263 0 0 0 0"
print(te)
data = re.findall(r'127.0.0.1.*?\n', te);
print(data)