mirror of
https://github.com/ppy/osu.git
synced 2026-06-04 03:33:40 +08:00
Escape user input before embedding into regex
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user