mirror of
https://github.com/ppy/osu
synced 2025-02-09 22:57:37 +00:00
Escape user input before embedding into regex
This commit is contained in:
parent
4873aaf7ed
commit
4cb122dad4
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user