// file : libbutl/regex.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file #include // move(), make_pair() namespace butl { template inline std::pair, bool> regex_replace_search (const std::basic_string& s, const std::basic_regex& re, const std::basic_string& fmt, std::regex_constants::match_flag_type flags) { using namespace std; using it = typename basic_string::const_iterator; basic_string r; bool match (regex_replace_search (s, re, fmt, [&r] (it b, it e) {r.append (b, e);}, flags)); return make_pair (move (r), match); } template inline std::pair, std::basic_string> regex_replace_parse (const std::basic_string& s, std::regex_constants::syntax_option_type f) { return regex_replace_parse (s.c_str (), s.size (), f); } template inline std::pair, std::basic_string> regex_replace_parse (const C* s, std::regex_constants::syntax_option_type f) { return regex_replace_parse ( s, std::basic_string::traits_type::length (s), f); } template inline std::basic_string regex_replace_match_results ( const std::match_results::const_iterator>& m, const std::basic_string& fmt) { return regex_replace_match_results (m, fmt.c_str (), fmt.size ()); } }