#include #include int main() { std::regex const pattern { "a?" }; std::cout << "'a?' match with '': " << std::boolalpha << std::regex_match("", pattern) << std::endl; std::cout << "'a?' match with 'a': " << std::boolalpha << std::regex_match("a", pattern) << std::endl; std::cout << "'a?' match with 'aaaa': " << std::boolalpha << std::regex_match("aaaa", pattern) << std::endl; }