5 #include <boost/algorithm/string.hpp>
13 std::regex rexp(regexp);
14 return std::regex_match(pattern, rexp);
17 bool is_glob(
std::string const& pattern) {
return (pattern.find_first_of(
"*?") != pattern.npos); }
21 boost::replace_all(regexp,
"*",
".*");
22 boost::replace_all(regexp,
"?",
".");
26 std::vector<std::vector<std::string>::const_iterator>
regexMatch(std::vector<std::string>
const& strings,
27 std::regex
const& regexp) {
28 std::vector<std::vector<std::string>::const_iterator> matches;
29 for (std::vector<std::string>::const_iterator
i = strings.begin(), iEnd = strings.end();
i != iEnd; ++
i) {
30 if (std::regex_match((*
i), regexp)) {
37 std::vector<std::vector<std::string>::const_iterator>
regexMatch(std::vector<std::string>
const& strings,
39 std::regex regexp(
glob2reg(pattern));
bool is_glob(std::string const &pattern)
std::string glob2reg(std::string const &pattern)
bool untaintString(char const *pattern, char const *regexp)
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const ®exp)