diff --git a/Base/Utils/StringUtils.cpp b/Base/Utils/StringUtils.cpp index ad3a9ae4d995f52c737a5f1813e60693f7895e42..c21d57792e6f8f675eb17ce6686db50f27266038 100644 --- a/Base/Utils/StringUtils.cpp +++ b/Base/Utils/StringUtils.cpp @@ -17,35 +17,6 @@ #include <charconv> #include <regex> -//! Returns true if text matches pattern with wildcards '*' and '?'. -bool BaseUtils::String::matchesPattern(const std::string& text, const std::string& wildcardPattern) -{ - // escape all regex special characters, except '?' and '*' - std::string mywildcardPattern = wildcardPattern; - boost::replace_all(mywildcardPattern, "\\", "\\\\"); - boost::replace_all(mywildcardPattern, "^", "\\^"); - boost::replace_all(mywildcardPattern, ".", "\\."); - boost::replace_all(mywildcardPattern, "$", "\\$"); - boost::replace_all(mywildcardPattern, "|", "\\|"); - boost::replace_all(mywildcardPattern, "(", "\\("); - boost::replace_all(mywildcardPattern, ")", "\\)"); - boost::replace_all(mywildcardPattern, "[", "\\["); - boost::replace_all(mywildcardPattern, "]", "\\]"); - boost::replace_all(mywildcardPattern, "+", "\\+"); - boost::replace_all(mywildcardPattern, "/", "\\/"); - - // Convert chars '*?' to their regex equivalents - boost::replace_all(mywildcardPattern, "?", "."); - boost::replace_all(mywildcardPattern, "*", ".*"); - - // constructing regexp pattern - mywildcardPattern = "^" + mywildcardPattern + "$"; - std::regex pattern(mywildcardPattern); - - // applaying match - return std::regex_match(text, pattern); -} - //! Returns string right-padded with blanks. std::string BaseUtils::String::padRight(const std::string& name, size_t length) { diff --git a/Base/Utils/StringUtils.h b/Base/Utils/StringUtils.h index 1df5265e0a5fa0d987aa949ad3810024eba57f36..f1516fb8dca70b02a7069e17e37c31b753ce5fb1 100644 --- a/Base/Utils/StringUtils.h +++ b/Base/Utils/StringUtils.h @@ -29,9 +29,6 @@ namespace BaseUtils::String { -//! Returns true if text matches pattern with wildcards '*' and '?'. -bool matchesPattern(const std::string& text, const std::string& wildcardPattern); - std::string padRight(const std::string& name, size_t length); //! Split string into vector of string using delimiter. diff --git a/Fit/Tools/StringUtils.cpp b/Fit/Tools/StringUtils.cpp index 5ca7e3667072cae8a5371441166a65b880904141..bc120812dfbdb6999e4f5d4b6cea1cbeb57f6db0 100644 --- a/Fit/Tools/StringUtils.cpp +++ b/Fit/Tools/StringUtils.cpp @@ -18,35 +18,6 @@ namespace mumufit { -//! Returns true if text matches pattern with wildcards '*' and '?'. -bool stringUtils::matchesPattern(const std::string& text, const std::string& wildcardPattern) -{ - // escape all regex special characters, except '?' and '*' - std::string mywildcardPattern = wildcardPattern; - boost::replace_all(mywildcardPattern, "\\", "\\\\"); - boost::replace_all(mywildcardPattern, "^", "\\^"); - boost::replace_all(mywildcardPattern, ".", "\\."); - boost::replace_all(mywildcardPattern, "$", "\\$"); - boost::replace_all(mywildcardPattern, "|", "\\|"); - boost::replace_all(mywildcardPattern, "(", "\\("); - boost::replace_all(mywildcardPattern, ")", "\\)"); - boost::replace_all(mywildcardPattern, "[", "\\["); - boost::replace_all(mywildcardPattern, "]", "\\]"); - boost::replace_all(mywildcardPattern, "+", "\\+"); - boost::replace_all(mywildcardPattern, "/", "\\/"); - - // Convert chars '*?' to their regex equivalents - boost::replace_all(mywildcardPattern, "?", "."); - boost::replace_all(mywildcardPattern, "*", ".*"); - - // constructing regexp pattern - mywildcardPattern = "^" + mywildcardPattern + "$"; - std::regex pattern(mywildcardPattern); - - // applaying match - return std::regex_match(text, pattern); -} - //! Returns token vector obtained by splitting string at delimiters. std::vector<std::string> stringUtils::split(const std::string& text, const std::string& delimiter) { diff --git a/Fit/Tools/StringUtils.h b/Fit/Tools/StringUtils.h index 80e6f9348c79384eec38d8a3b03e975c82e60e3d..e66beee7cc1bfb16c12b74144349f8240903d954 100644 --- a/Fit/Tools/StringUtils.h +++ b/Fit/Tools/StringUtils.h @@ -29,9 +29,6 @@ namespace mumufit::stringUtils { -//! Returns true if text matches pattern with wildcards '*' and '?'. -bool matchesPattern(const std::string& text, const std::string& wildcardPattern); - //! Split string into vector of string using delimeter. std::vector<std::string> split(const std::string& text, const std::string& delimeter); diff --git a/auto/Wrap/doxygenBase.i b/auto/Wrap/doxygenBase.i index ad090e82e5ac4a161afbdcde9f85a93826bcfeb3..12e9e4e218a511ec4bdc0e97e2e0c8321b77fb2b 100644 --- a/auto/Wrap/doxygenBase.i +++ b/auto/Wrap/doxygenBase.i @@ -1413,11 +1413,6 @@ Returns string representing python stack trace. // File: namespaceBaseUtils_1_1String.xml -%feature("docstring") BaseUtils::String::matchesPattern "bool BaseUtils::String::matchesPattern(const std::string &text, const std::string &wildcardPattern) - -Returns true if text matches pattern with wildcards '*' and '?'. -"; - %feature("docstring") BaseUtils::String::padRight "std::string BaseUtils::String::padRight(const std::string &name, size_t length) Returns string right-padded with blanks. diff --git a/auto/Wrap/doxygenFit.i b/auto/Wrap/doxygenFit.i index 623be4302b71e0ed6a60fab5889b69018863c6bc..630680290a5f8335abbaa8cb055cee117cb5198c 100644 --- a/auto/Wrap/doxygenFit.i +++ b/auto/Wrap/doxygenFit.i @@ -12608,11 +12608,6 @@ Reports results of minimization in the form of multi-line string. // File: namespacemumufit_1_1stringUtils.xml -%feature("docstring") mumufit::stringUtils::matchesPattern "bool mumufit::stringUtils::matchesPattern(const std::string &text, const std::string &wildcardPattern) - -Returns true if text matches pattern with wildcards '*' and '?'. -"; - %feature("docstring") mumufit::stringUtils::split "std::vector< std::string > mumufit::stringUtils::split(const std::string &text, const std::string &delimeter) Split string into vector of string using delimeter.