Given an old-style const char * pointer and a length, is there a way to call std::regex_search() on it without first copying the contents of the bu
The error in your code is that you're using the wrong match_results type. smatch is supposed to be used when you have an std::string object and you're passing std::string::iterators to the regex function. When you have raw char const *s use cmatch instead.
Change
std::smatch what;
to
std::cmatch what;
Live demo