I need to split a string into "string chunks" based a token found via regex. I also need to save the token itself as part of the final string chunk

Here is the regex and input string showing the complexity of what I'm after: <https://regex101.com/r/bR9gW9/1>

I tried to make a simple example but it fails to compile: <http://cpp.sh/9qifd>

```
#include <iostream>
#include <string>
#include <boost/regex.hpp>
#include <vector>
using namespace std;

int main()
{
    string data = "TAKE some stuff\nTAKE other stuff\nTAKE more stuff\n";
    boost::regex separate_take_chunks("TAKE");
    vector<string> take_chunks;
    //boost::sregex_token_iterator i(data.begin(), data.end(), separate_take_chunks, -1);
    boost::sregex_token_iterator j;
    //while (i != j) cout << *i++;
}

```

Here's using std regex which works but it doesn't give me the tokens <http://cpp.sh/2jlv>

```
#include <iostream>
#include <string>
#include <regex>

using namespace std;

int main()
{
    string data = "TAKE some stuff\nTAKE other stuff\nTAKE more stuff\n";
    std::regex separate_take_chunks("TAKE");
    std::sregex_token_iterator iter(data.begin(), data.end(), separate_take_chunks, -1);
    std::sregex_token_iterator end;
    for ( ; iter != end; ++iter)
    std::cout << *iter << "---\n";
}

```

Here's not using regex, but if I could replace the find function with regex, this would work well:

```
size_t p1 = 4;
size_t p2 = 0;
while (p2 != string::npos) {
    p2 = data.find("TAKE\n", p1);
    take_chunks.push_back(data.substr(p1-4, p2));
    p1 = p2+4;
}   

```