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

Escape user input before embedding into regex

This commit is contained in:
Bartłomiej Dach
2023-06-26 22:27:48 +02:00
Unverified
parent 4873aaf7ed
commit 4cb122dad4
+1 -1
View File
@@ -150,7 +150,7 @@ namespace osu.Game.Screens.Select
return false;
if (Exact)
return Regex.IsMatch(value, $@"(^|\s){searchTerm}($|\s)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
return Regex.IsMatch(value, $@"(^|\s){Regex.Escape(searchTerm)}($|\s)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
return value.Contains(SearchTerm, StringComparison.InvariantCultureIgnoreCase);
}