fork(3) download
  1. #include <regex>
  2. #include <string>
  3. #include <iostream>
  4. #include <time.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string data("ABOUTLinkedIn\r\n\r\nwall of textdl.boxcloud.com/this/file/bitbyte.zip sent you a message.\r\n\r\nDate: 12/04/2012\r\n\r\nSubject: RE: Reference Ask\r\n\r\nOn 12/03/12 2:02 PM, wall of text wrote:\r\n--------------------\r\nRuba,\r\n\r\nI am looking for a n.");
  10. std::regex pattern("(dl\\.boxcloud\\.com|api-content\\.dropbox\\.com)");
  11. std::smatch result;
  12.  
  13. while (regex_search(data, result, pattern)) {
  14. std::cout << "Match: " << result[0] << std::endl;
  15. std::cout << "Captured text 1: " << result[1] << std::endl;
  16. std::cout << "Size: " << result.size() << std::endl;
  17. data = result.suffix().str();
  18. }
  19. }
Success #stdin #stdout 0s 3500KB
stdin
Standard input is empty
stdout
Match: dl.boxcloud.com
Captured text 1: dl.boxcloud.com
Size: 2