C++ Boost Regex doesn't save capture -


i trying communicate web page,retrieve it's source code , search , store specific strings( names ) inside output file. here did:

    #include <iostream> #include <string> #include <conio.h> #include <boost/asio.hpp> #include <boost/regex.hpp> #include <fstream> using namespace std; ofstream o("out.txt"); int main() {     boost::asio::ip::tcp::iostream s("www.lolsummoners.com", "http");     if(!s)         cout << "could not connect http://www.lolsummoners.com/\n";     s  << "get /ladders/eune http/1.1\r\n"        << "host: www.lolsummoners.com\r\n"        << "accept: */*\r\n"        << "connection: close\r\n\r\n" ;        boost::regex rgx("/leagues/.*>(.+\\s*)</a></td>");     for(string line; getline(s, line); )     {         boost::smatch matches;         if(regex_search(line, matches, rgx ) )         {             o << matches[0] << '\n';         }     } } 

the problem is,that in output file,it doesn't save capture,instead,it saved whole thing:

/leagues/eune/64657">kenachi</a></td> 

i want save "kenachi" without "

matches[0] whole matched expression.

the first capture group in matches[1].


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -