feat: rewrite window classes

feat: cache window class rewrite resolution

Co-authored-by: Gabriel Fox <Inbox@GabrielFox.Dev>
This commit is contained in:
Brenno Lemos
2023-09-22 18:18:02 -03:00
parent 3e2761e81f
commit b9d5912a4f
3 changed files with 40 additions and 32 deletions

View File

@ -1,5 +1,6 @@
#include "util/rewrite_string.hpp"
#include <fmt/core.h>
#include <spdlog/spdlog.h>
#include <regex>
@ -17,7 +18,7 @@ std::string rewriteString(const std::string& value, const Json::Value& rules) {
try {
// malformated regexes will cause an exception.
// in this case, log error and try the next rule.
const std::regex rule{it.key().asString()};
const std::regex rule{it.key().asString(), std::regex_constants::icase};
if (std::regex_match(value, rule)) {
res = std::regex_replace(res, rule, it->asString());
}