diff options
Diffstat (limited to 'src/stringutils.cpp')
-rw-r--r-- | src/stringutils.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/stringutils.cpp b/src/stringutils.cpp index f580266..05e6a01 100644 --- a/src/stringutils.cpp +++ b/src/stringutils.cpp @@ -24,11 +24,12 @@ #include <string> #include <algorithm> +#include <cctype> #include <cstdarg> #include <cstdio> -#include <cctype> -#include <list> #include <ctime> +#include <list> +#include <regex> std::string &trim(std::string &str) { @@ -694,3 +695,9 @@ void secureChatCommand(std::string &str) if (str[0] == '/' || str[0] == '@' || str[0] == '#') str = "_" + str; } + +bool isMatch(const std::string &str, const std::string &exp) +{ + std::regex regExp(exp); + return std::regex_match(str, regExp); +} |