1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-03 03:20:16 +08:00

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.
This commit is contained in:
Bartłomiej Dach
2025-08-13 10:07:03 +02:00
Unverified
parent 6ddb2d3305
commit 08a0025e31
+1 -1
View File
@@ -16,7 +16,7 @@ namespace osu.Game.Screens.Select
public static class FilterQueryParser
{
private static readonly Regex query_syntax_regex = new Regex(
@"\b(?<key>\w+)(?<op>(!?(:|=)|(>|<)(:|=)?))(?<value>("".*""[!]?)|(\S*))",
@"\b(?<key>\w+)(?<op>(!?(:|=)|(>|<)(:|=)?))(?<value>("".*?""[!]?)|(\S*))",
RegexOptions.Compiled | RegexOptions.IgnoreCase);
internal static void ApplyQueries(FilterCriteria criteria, string query)