This commit is contained in:
WarmUpTill
2026-03-07 21:15:37 +01:00
committed by WarmUpTill
parent ff98ec36d6
commit 70e5f6002d
2 changed files with 3 additions and 14 deletions

View File

@@ -1,15 +1,12 @@
#include "text-helpers.hpp"
#include <regex>
#include <QRegularExpression>
namespace advss {
QString EscapeForRegex(const QString &s)
QString EscapeForRegex(const QString &input)
{
static std::regex specialChars{R"([-[\]{}()*+?.,\^$|#\s])"};
std::string input = s.toStdString();
return QString::fromStdString(
std::regex_replace(input, specialChars, R"(\$&)"));
return QRegularExpression::escape(input);
}
} // namespace advss