diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-07-27 14:28:49 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-07-27 14:28:49 -0500 |
commit | ff01c3ade4c092214d9488b10cbca995fbc7f159 (patch) | |
tree | e30c08e57338ee269373f65911e26ebe997c26d6 /src/common/util.cpp | |
parent | Merge pull request #4109 (diff) | |
parent | core_tests: add --filter to select which tests to run (diff) | |
download | monero-ff01c3ade4c092214d9488b10cbca995fbc7f159.tar.xz |
Merge pull request #4110
639ca3b core_tests: add --filter to select which tests to run (moneromooo-monero)
Diffstat (limited to 'src/common/util.cpp')
-rw-r--r-- | src/common/util.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp index 7d9d7b408..f644c573c 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -919,4 +919,23 @@ std::string get_nix_version_display_string() return {}; } } + + std::string glob_to_regex(const std::string &val) + { + std::string newval; + + bool escape = false; + for (char c: val) + { + if (c == '*') + newval += escape ? "*" : ".*"; + else if (c == '?') + newval += escape ? "?" : "."; + else if (c == '\\') + newval += '\\', escape = !escape; + else + newval += c; + } + return newval; + } } |