I'm retrieving a search pattern from an excel file which is the base name for multiple other files, i'm then retrieving all those other files and trying to match the files with the base name.
So let say the base name is 328.pdf
. It be can anything except a space character.
Then the files, for example ./Input\32581.pdf
and ./Input\32896.pdf
would be matched.
I have managed this so far:
regex = new Regex($@".*({data[i, j]})(.[^\s]*)(\.pdf?)\w+");
var matchingFiles = PdfFiles.Where(x => regex.IsMatch(x)).ToList();`
But it fails for the backslash
before the file name, and i couldn't find how to include it in the search pattern. Any help is appreciated.
The data[i, j]
is the base name.