下面的程序输出是“它不匹配”,但理想情况下应该是“它匹配”?
#include <iostream>
#include <string>
#include <regex>
using namespace std;
using namespace regex_constants;
int main()
{
string pattern = "[a]*";
try {
regex re(pattern, extended);
if(regex_match("aaaa", re))
cout << "It is matching" << endl;
else
cout << "It is not matching" << endl;
}catch(regex_error &e)
{
cout << e.what() << endl;
}
return 0;
}