#include <iostream>
#include <regex>
#include <string>
using namespace std;
int main() {
regex rex(R"(([\s\S]*)<FooBar>)");
string s("abcde\n fghij<FooBar>");
smatch m;
if (regex_search(s, m, rex)) {
std::cout << m.str(1) << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cmVnZXg+CiNpbmNsdWRlIDxzdHJpbmc+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCXJlZ2V4IHJleChSIigoW1xzXFNdKik8Rm9vQmFyPikiKTsKCXN0cmluZyBzKCJhYmNkZVxuCQlmZ2hpajxGb29CYXI+Iik7CglzbWF0Y2ggbTsKCWlmIChyZWdleF9zZWFyY2gocywgbSwgcmV4KSkgewoJCXN0ZDo6Y291dCA8PCBtLnN0cigxKSA8PCBzdGQ6OmVuZGw7Cgl9CglyZXR1cm4gMDsKfQ==