我对以下C++ 11代码感到有点困惑:
#include <iostream>
#include <string>
#include <regex>
int main()
{
std::string haystack("abcdefabcghiabc");
std::regex needle("abc");
std::smatch matches;
std::regex_search(haystack, matches, needle);
std::cout << matches.size() << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
我希望它打印出来,3但我得到了1.我错过了什么吗?