diff --git a/src/tools/regexTools.cpp b/src/tools/regexTools.cpp index 3f1d5b8ab..914404085 100644 --- a/src/tools/regexTools.cpp +++ b/src/tools/regexTools.cpp @@ -30,7 +30,7 @@ std::map> regexCache; static pthread_mutex_t regexLock = PTHREAD_MUTEX_INITIALIZER; -std::unique_ptr buildMatcher(const std::string& regex, const icu::UnicodeString& content) +std::unique_ptr buildMatcher(const std::string& regex, icu::UnicodeString& content) { std::shared_ptr pattern; /* Regex is in cache */ @@ -56,7 +56,8 @@ std::unique_ptr buildMatcher(const std::string& regex, const bool matchRegex(const std::string& content, const std::string& regex) { ucnv_setDefaultName("UTF-8"); - auto matcher = buildMatcher(regex, content.c_str()); + icu::UnicodeString ucontent(content.c_str()); + auto matcher = buildMatcher(regex, ucontent); return matcher->find(); }