fork(67) download
  1. #include <stdio.h>
  2. #include <string>
  3. #include <regex>
  4.  
  5. int main (void)
  6. {
  7. std::string in="{ab}{cd}[ef]{gh}[ij][kl]"; // the input-string
  8.  
  9. std::regex rx1 ("(\\{.+?})(.*)"); // non-greedy?
  10. std::smatch match;
  11.  
  12. if (regex_match (in, match, rx1))
  13. {
  14. printf ("\n%s\n", match.str(1).c_str());
  15. }
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 3552KB
stdin
Standard input is empty
stdout
{ab}