fork download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. std::string s = ">NZ_FNBK01000055.1 Halorientalis regularis ";
  8. std::regex rgx(">.*? (.*?) .*$");
  9. std::smatch matches;
  10.  
  11. if(std::regex_search(s, matches, rgx)) {
  12. if (matches.size() > 1) {
  13. std::cout << "The name is " << matches[1].str() << "\n";
  14. }
  15. }
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 15336KB
stdin
Standard input is empty
stdout
The name is Halorientalis