24 std::string
substitute (
const std::string&
str,
const std::string& pattern,
25 const std::string& with)
30 std::string::size_type pos;
31 while ((pos =
result.find (pattern)) != std::string::npos) {
41 std::match_results<std::string::const_iterator> what;
42 std::size_t
count = std::regex_match(
str.begin(),
str.end(), what, expr);
43 for (std::size_t iter = 0; iter !=
count; ++iter)
45 if (what[iter].matched && what[iter].first ==
str.begin() &&
46 what[iter].second ==
str.end())
56 for (std::string::const_iterator iter = glob.begin(),
57 end = glob.end(); iter != end; ++ iter)
62 }
else if (*iter ==
'?')
65 }
else if (*iter ==
'^' || *iter ==
'$' || *iter ==
'+' || *iter ==
'.')
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
This module defines a variety of assert style macros.
bool match_expr(const std::regex &expr, const std::string &str)
returns: whether we can match the entire string with the regular expression guarantee: strong failure...
std::string substitute(const std::string &str, const std::string &pattern, const std::string &with)
effects: substitute all occurences of "pattern" with "with" in the string "str" returns: the substitu...
std::string glob_to_regexp(const std::string &glob)
returns: a string that is the regular expression equivalent of the given glob expression guarantee: s...