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
Post a Comment