Match m = Regex.Match("\\\\server1\\Cold Folder1\\title and text number06220-03-15-2015.pdf", "\\\\server1\\Cold Folder1\\(title and text number.*\\.pdf)");
Match m = Regex.Match("\\\\server1\\Cold Folder1\\title and text number06220-03-15-2015.pdf", @"\\server1\Cold Folder1\(title and text number.*\.pdf)");
Both ways give me the error "Unrecognized Escape Character \C
. And I am stumped as to why.
What do I have to change to get this result?
Console.WriteLine("{0} produces the filename: {1}.", m.Groups[0].Value, m.Groups[1].Value);
// \\server1\Cold Folder1\title and text number06220-03-15-2015.pdf produces the filename: title and text number06220-03-15-2015.pdf
Full error: Unhandled Exception: System. ArgumentException: parsing "\\server1\Cold Folder1\(title and text number.*\.pdf)"