mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Support wildcard in history form filename filter
This commit is contained in:
parent
d0f9b46075
commit
457e13b7bb
1 changed files with 4 additions and 1 deletions
|
@ -30,6 +30,7 @@ You should have received a copy of the GNU General Public License
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace ShareX.HistoryLib
|
namespace ShareX.HistoryLib
|
||||||
|
@ -149,7 +150,9 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filenameFilter))
|
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;
|
string urlFilter = txtURLFilter.Text;
|
||||||
|
|
Loading…
Reference in a new issue