From 08a0025e31ed0569c663ed02965d75fd7cdcaddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 13 Aug 2025 10:07:03 +0200 Subject: [PATCH] Fix keyword filters potentially being wrongly merged together due to regex wildcard greedy matching Because of greedy matching, a filter of tag="style/clean"! tag="song representation/simple"! would not parse into 2 separate filters like (tag, =, "style/clean"!) (tag, =, "song representation/simple"!) but rather a single one like (tag, =, "style/clean"! tag="song representation/simple"!) This sort of matches what web did in https://github.com/ppy/osu-web/pull/12044, except web does some stuff with quote escaping that I'd rather not, and also the search syntax seems to slightly deviate because web seems to be using single quotes and double quotes to open the value part of the filter. I'm not sure what the difference is and I'd rather not go into all that right now. --- osu.Game/Screens/Select/FilterQueryParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterQueryParser.cs b/osu.Game/Screens/Select/FilterQueryParser.cs index 36afd8fb72..094e4dfe61 100644 --- a/osu.Game/Screens/Select/FilterQueryParser.cs +++ b/osu.Game/Screens/Select/FilterQueryParser.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Select public static class FilterQueryParser { private static readonly Regex query_syntax_regex = new Regex( - @"\b(?\w+)(?(!?(:|=)|(>|<)(:|=)?))(?("".*""[!]?)|(\S*))", + @"\b(?\w+)(?(!?(:|=)|(>|<)(:|=)?))(?("".*?""[!]?)|(\S*))", RegexOptions.Compiled | RegexOptions.IgnoreCase); internal static void ApplyQueries(FilterCriteria criteria, string query)