I have a regex which by regex101 works correctly:
There are 2 matches, as intended.
Now I'd like to split the same with std's regex_token_iterator:
const std::string text = "This is a test string [more or less] and here is [another].";
const std::regex ws_re("\(?<=\[)(.*?)(?=\])\gm"); // HOW TO WRITE THE ABOVE REGEX IN HERE?
std::copy( std::sregex_token_iterator(text.begin(), text.end(), ws_re, -1),
std::sregex_token_iterator(),
std::ostream_iterator<std::string>(std::cout, "\n"));
This compiles fine, but nothing is printed to stdout.
I think the regex has to be written somehow else, can you please point on my mistake?
