mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-12 15:57:57 +00:00
Revert "Consider brackets within wildcard as regular characters"
The implementation appeared to be broken. This reverts #16965. PR #17820.
This commit is contained in:
parent
e7370d1a0f
commit
ad59eb4dfc
@ -32,11 +32,12 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#else
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -56,11 +57,7 @@ QString Utils::String::fromDouble(const double n, const int precision)
|
|||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
||||||
{
|
{
|
||||||
// replace [ and ] with [[] and []], respectively
|
return QRegularExpression::wildcardToRegularExpression(pattern, QRegularExpression::UnanchoredWildcardConversion);
|
||||||
QString escapedPattern = pattern;
|
|
||||||
escapedPattern.replace(QRegularExpression(u"\\[|\\]"_qs), u"[\\0]"_qs);
|
|
||||||
|
|
||||||
return QRegularExpression::wildcardToRegularExpression(escapedPattern, QRegularExpression::UnanchoredWildcardConversion);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// This is marked as internal in QRegExp.cpp, but is exported. The alternative would be to
|
// This is marked as internal in QRegExp.cpp, but is exported. The alternative would be to
|
||||||
@ -69,11 +66,7 @@ QString qt_regexp_toCanonical(const QString &pattern, QRegExp::PatternSyntax pat
|
|||||||
|
|
||||||
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
QString Utils::String::wildcardToRegexPattern(const QString &pattern)
|
||||||
{
|
{
|
||||||
// replace [ and ] with [[] and []], respectively
|
return qt_regexp_toCanonical(pattern, QRegExp::Wildcard);
|
||||||
QString escapedPattern = pattern;
|
|
||||||
escapedPattern.replace(QRegularExpression(u"\\[|\\]"_qs), u"[\\0]"_qs);
|
|
||||||
|
|
||||||
return qt_regexp_toCanonical(escapedPattern, QRegExp::Wildcard);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user