16 #include <boost/algorithm/string.hpp>
25 std::string mywildcardPattern = wildcardPattern;
26 boost::replace_all(mywildcardPattern,
"\\",
"\\\\");
27 boost::replace_all(mywildcardPattern,
"^",
"\\^");
28 boost::replace_all(mywildcardPattern,
".",
"\\.");
29 boost::replace_all(mywildcardPattern,
"$",
"\\$");
30 boost::replace_all(mywildcardPattern,
"|",
"\\|");
31 boost::replace_all(mywildcardPattern,
"(",
"\\(");
32 boost::replace_all(mywildcardPattern,
")",
"\\)");
33 boost::replace_all(mywildcardPattern,
"[",
"\\[");
34 boost::replace_all(mywildcardPattern,
"]",
"\\]");
35 boost::replace_all(mywildcardPattern,
"+",
"\\+");
36 boost::replace_all(mywildcardPattern,
"/",
"\\/");
39 boost::replace_all(mywildcardPattern,
"?",
".");
40 boost::replace_all(mywildcardPattern,
"*",
".*");
43 mywildcardPattern =
"^" + mywildcardPattern +
"$";
44 std::regex pattern(mywildcardPattern);
47 return std::regex_match(text, pattern);
51 std::vector<std::string>
stringUtils::split(
const std::string& text,
const std::string& delimiter)
53 std::vector<std::string> tokens;
std::vector< std::string > split(const std::string &text, const std::string &delimeter)
Split string into vector of string using delimeter.
std::vector< std::string > split(const std::string &text, const std::string &delimeter)
Split string into vector of string using delimeter.
bool matchesPattern(const std::string &text, const std::string &wildcardPattern)
Returns true if text matches pattern with wildcards '*' and '?'.
The multi-library, multi-algorithm fit wrapper library.