From 77c68a3142faf20d03c37bd1a71d4c05d39c4a29 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Tue, 2 Feb 2021 20:36:54 -0600 Subject: [PATCH] DolphinQt: Fix regression that caused the regex expression to be evaluated incorrectly. If an input expression has a non-alpha character in it, we want to quote it with backticks --- Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp index 3678cceb89..6765485c10 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingCommon.cpp @@ -51,8 +51,10 @@ QString GetExpressionForControl(const QString& control_name, if (quote == Quote::On) { - const QRegularExpression reg(QStringLiteral("[a-zA-Z]+")); - if (!reg.match(expr).hasMatch()) + // If our expression contains any non-alpha characters + // we should quote it + const QRegularExpression reg(QStringLiteral("[^a-zA-Z]")); + if (reg.match(expr).hasMatch()) expr = QStringLiteral("`%1`").arg(expr); }