diff --git a/SabreTools.Helper/Dats/Filter.cs b/SabreTools.Helper/Dats/Filter.cs index 28014fcd..571d44c8 100644 --- a/SabreTools.Helper/Dats/Filter.cs +++ b/SabreTools.Helper/Dats/Filter.cs @@ -470,7 +470,7 @@ namespace SabreTools.Helper.Dats /// Value to search the list for /// True if the value could be found, false otherwise /// TODO: Add proper regex matching to all strings - private bool FindValueInList(List haystack, string needle) + private bool FindValueInList(List haystack, string needle, bool regex = false) { bool found = false; foreach (string straw in haystack) @@ -478,7 +478,7 @@ namespace SabreTools.Helper.Dats if (!String.IsNullOrEmpty(straw)) { // Pre-process the straw to make it regex-compatibile - string regexStraw = "^" + (straw.StartsWith("*") ? ".*" : "") + Regex.Escape(straw.Trim('*')) + (straw.EndsWith("*") ? ".*" : "") + "$"; + string regexStraw = (!regex ? "^" + (straw.StartsWith("*") ? ".*" : "") + Regex.Escape(straw.Trim('*')) + (straw.EndsWith("*") ? ".*" : "") + "$" : straw); // Check if a match is found with the regex found |= Regex.IsMatch(needle, straw, RegexOptions.IgnoreCase);