Merge pull request #9487 from iwubcode/qt_regex_regression

DolphinQt: Fix regression in input expressions
This commit is contained in:
LC 2021-02-02 22:00:11 -05:00 committed by GitHub
commit 7250d6e4e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -51,8 +51,10 @@ QString GetExpressionForControl(const QString& control_name,
if (quote == Quote::On) if (quote == Quote::On)
{ {
const QRegularExpression reg(QStringLiteral("[a-zA-Z]+")); // If our expression contains any non-alpha characters
if (!reg.match(expr).hasMatch()) // we should quote it
const QRegularExpression reg(QStringLiteral("[^a-zA-Z]"));
if (reg.match(expr).hasMatch())
expr = QStringLiteral("`%1`").arg(expr); expr = QStringLiteral("`%1`").arg(expr);
} }