I screwed up my last post. Lets see if I can get this one right..
Would anyone be able to tell me how to pull the server name out of a UNC? (I'm looking for a regex)
this is the string I want to pull the servername from:
**\\\servername\d$\directory**
My Code is in C#
Regex r = new Regex(?????, RegexOptions.IgnoreCase);
Match m = r.Match(@"\\servername\d$\directory");
CaptureCollection cc = m.Captures;
foreach (Capture c in cc)
{
System.Console.WriteLine(c);
}
I am looking to capture just: servername
no slashes or anything.