From ea69e350aada8f767d24d3ebacac19412994a6b7 Mon Sep 17 00:00:00 2001 From: Robert Morrison Date: Mon, 20 Jun 2022 02:54:20 +0100 Subject: [PATCH] Implement GetAllFilesMatching function --- Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Program.cs b/Program.cs index ae823de..08b9a6c 100644 --- a/Program.cs +++ b/Program.cs @@ -111,6 +111,12 @@ class Program List res = new List(); List files = GetAllFiles(directory); + Regex expression = new Regex(pattern, + RegexOptions.Compiled); + + res = files.FindAll( x => expression.IsMatch(x)); // Here a lambda function is used as a predicate to do regex across the whole file list + + return res; void Usage() { /*