mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Filter] Add safeguard case for exact matches
This commit is contained in:
@@ -476,8 +476,16 @@ namespace SabreTools.Helper.Dats
|
|||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(straw))
|
if (!String.IsNullOrEmpty(straw))
|
||||||
{
|
{
|
||||||
|
string regexStraw = straw;
|
||||||
|
|
||||||
|
// If the straw has no special characters at all, treat it as an exact match
|
||||||
|
if (regexStraw == Regex.Escape(regexStraw))
|
||||||
|
{
|
||||||
|
regexStraw = "^" + regexStraw + "$";
|
||||||
|
}
|
||||||
|
|
||||||
// Check if a match is found with the regex
|
// Check if a match is found with the regex
|
||||||
found |= Regex.IsMatch(needle, straw, RegexOptions.IgnoreCase);
|
found |= Regex.IsMatch(needle, regexStraw, RegexOptions.IgnoreCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user