#include <iostream>
#include <regex>
#include <string>
int main()
{
std::string example{" <match1> <match2> <match3>"};
std::regex re{"<([^>]+)>"};
std::regex_token_iterator<std::string::iterator> it{example.begin(), example.end(), re, 1};
decltype(it) end{};
while (it != end) std::cout << *it++ << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cmVnZXg+CiNpbmNsdWRlIDxzdHJpbmc+CgppbnQgbWFpbigpIAp7CglzdGQ6OnN0cmluZyBleGFtcGxleyIgICA8bWF0Y2gxPiAgPG1hdGNoMj4gICAgPG1hdGNoMz4ifTsKCXN0ZDo6cmVnZXggcmV7IjwoW14+XSspPiJ9OwoJc3RkOjpyZWdleF90b2tlbl9pdGVyYXRvcjxzdGQ6OnN0cmluZzo6aXRlcmF0b3I+IGl0e2V4YW1wbGUuYmVnaW4oKSwgZXhhbXBsZS5lbmQoKSwgcmUsIDF9OwoJZGVjbHR5cGUoaXQpIGVuZHt9OwoJd2hpbGUgKGl0ICE9IGVuZCkgc3RkOjpjb3V0IDw8ICppdCsrIDw8IHN0ZDo6ZW5kbDsKCXJldHVybiAwOwp9