#include #include int main() { std::regex pattern { "^a" }; std::cout << "'^a' match with '': " << std::boolalpha << std::regex_search("", pattern) << std::endl; std::cout << "'^a' match with 'abcd': " << std::boolalpha << std::regex_search("abcd", pattern) << std::endl; std::cout << "'^a' match with 'dcba': " << std::boolalpha << std::regex_search("dcba", pattern) << std::endl << std::endl; pattern = "a$"; std::cout << "'a$' match with '': " << std::boolalpha << std::regex_search("", pattern) << std::endl; std::cout << "'a$' match with 'abcd': " << std::boolalpha << std::regex_search("abcd", pattern) << std::endl; std::cout << "'a$' match with 'dcba': " << std::boolalpha << std::regex_search("dcba", pattern) << std::endl; }