fork(3) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <regex>
  4.  
  5. int main()
  6. {
  7. std::string html = "<ul><a href=\"http://stackoverflow.com\">SO</a></ul> "
  8. "<ul>abc</ul>\n";
  9. std::regex url_re(R"(<ul>([\s\S]*?)<\/ul>)", std::regex::icase);
  10. std::copy( std::sregex_token_iterator(html.begin(), html.end(), url_re, 1),
  11. std::sregex_token_iterator(),
  12. std::ostream_iterator<std::string>(std::cout, "\n"));
  13. }
Success #stdin #stdout 0s 4528KB
stdin
Standard input is empty
stdout
<a href="http://stackoverflow.com">SO</a>
abc