mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 19:20:27 +12:00
Support wildcard in history form filename filter
This commit is contained in:
parent
d0f9b46075
commit
457e13b7bb
|
@ -30,6 +30,7 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.HistoryLib
|
||||
|
@ -149,7 +150,9 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
|||
|
||||
if (!string.IsNullOrEmpty(filenameFilter))
|
||||
{
|
||||
result = result.Where(x => x.Filename != null && x.Filename.Contains(filenameFilter, StringComparison.InvariantCultureIgnoreCase));
|
||||
string pattern = Regex.Escape(filenameFilter).Replace("\\?", ".").Replace("\\*", ".*");
|
||||
Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
result = result.Where(x => x.Filename != null && regex.IsMatch(x.Filename));
|
||||
}
|
||||
|
||||
string urlFilter = txtURLFilter.Text;
|
||||
|
|
Loading…
Reference in a new issue