c++ - How do you print a std::regex? -


how print string representation of std::regex?

say have collection of patterns, , i'd print first 1 matches:

std::vector<std::regex>> patterns = get(); (auto pattern: patterns){   if (std::regex_match("file.txt",pattern)){     std::cout << "matched on pattern: " << /* ? pattern ? */ << '\n';   } } 

std::cout not work on std::regex.

there doesn't seem methods string representation.

are expected carry around string separately, or missing in docs?

there doesn't seem methods string representation.

correct. not specified std::regex saves expression in form gave it, might case if implementation decides use more optimized format.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -