fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <regex>
  5. using namespace std;
  6.  
  7. int main() {
  8. regex re("<\\s*A\\s+(?:[^>]*?\\s+)?href\\s*=\\s*\"([^\"]*)\"", std::regex_constants::icase);
  9. string subject("<head><title>Search engines</title></head><body><a href=\"https://y...content-available-to-author-only...x.ru\">Yandex</a><a href=\"https://google.com\"></a></body>");
  10. vector<string> result(sregex_token_iterator(subject.begin(), subject.end(), re, 1),
  11. sregex_token_iterator());
  12.  
  13. for( auto & s : result ) cout << s << endl;
  14. return 0;
  15. }
Success #stdin #stdout 0s 15344KB
stdin
Standard input is empty
stdout
https://y...content-available-to-author-only...x.ru
https://google.com