30std::vector<std::string>
listFiles(std::string
const& dir, std::string
const& searchpattern)
32 std::vector<std::string> filenames;
33 std::string rs = searchpattern.empty() ?
".*" : searchpattern;
34 std::regex str_expr(rs);
36 for (
auto& p : std::filesystem::directory_iterator(dir)) {
38 if (!p.is_directory()) {
39 auto fn = p.path().filename().string();
40 if (regex_match(fn, str_expr)) {
41 filenames.push_back(p.path().string());
71 std::regex e(R
"(\$\{?[a-zA-Z0-9_]*\}?)");
72 std::regex e3("[a-zA-Z0-9_]+");
74 std::sregex_iterator iter;
75 auto words_end = std::sregex_iterator();
76 auto words_begin = std::sregex_iterator(input.begin(), input.end(), e);
79 if (words_end == words_begin) {
84 for (
auto i = words_begin;
i != words_end; ++
i) {
88 std::string s(
match.str());
90 if (std::regex_search(s,
m, e3)) {
91 auto envlookup = getenv(
m[0].
str().c_str());
93 finalstr +=
match.prefix().str() + std::string(envlookup);
96 finalstr +=
match.prefix().str() +
"${" +
m[0].str().c_str() +
"}";
98 tail =
match.suffix().str();