diff --git a/SabreTools.Helper/Dats/Filter.cs b/SabreTools.Helper/Dats/Filter.cs index e9f46ded..7259acba 100644 --- a/SabreTools.Helper/Dats/Filter.cs +++ b/SabreTools.Helper/Dats/Filter.cs @@ -469,19 +469,15 @@ namespace SabreTools.Helper.Dats /// List to search for the value in /// 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, bool regex = false) + private bool FindValueInList(List haystack, string needle) { bool found = false; foreach (string straw in haystack) { if (!String.IsNullOrEmpty(straw)) { - // Pre-process the straw to make it regex-compatibile - 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, regexStraw, RegexOptions.IgnoreCase); + found |= Regex.IsMatch(needle, straw, RegexOptions.IgnoreCase); } } diff --git a/SabreTools.Helper/README.1ST b/SabreTools.Helper/README.1ST index 1bb410f3..8dcc55a9 100644 --- a/SabreTools.Helper/README.1ST +++ b/SabreTools.Helper/README.1ST @@ -955,13 +955,9 @@ Options: -nmd5=, --not-md5= Exclude by MD5 hash -sha1=, --sha1= Filter by SHA-1 hash -nsha1=, --not-sha1= Exclude by SHA-1 hash - For each of the flags above, the user can specify either an exact match or can use a - wildcard as defined below (case-insensitive): - *00 means ends with '00' - 00* means starts with '00' - *00* means contains '00' - 00 means exactly equals '00' - Multiples of each of the above inputs are allowed. + For each of the flags above, the user can specify either an exact match or can use + full C#-style regex for pattern matching. Multiples of each of the above inputs are + allowed. -ofg, --of-as-game Allow cloneof and romof tags to match game name filters If filter or exclude by game name is used, this flag will allow those filters to diff --git a/SabreTools/Partials/SabreTools.Help.cs b/SabreTools/Partials/SabreTools.Help.cs index c4485c0a..e71d94f6 100644 --- a/SabreTools/Partials/SabreTools.Help.cs +++ b/SabreTools/Partials/SabreTools.Help.cs @@ -647,11 +647,7 @@ namespace SabreTools "", "Filter parameters game name, rom name, CRC, MD5, SHA-1 can", - "do partial matches using asterisks as follows (case insensitive):", - " *00 means ends with '00'", - " 00* means starts with '00'", - " *00* means contains '00'", - " 00 means exactly equals '00'", + "be matched using full C#-style regex.", "", "Filter parameters for size can use postfixes for inputs:",