string
ipPattern = @"\\{2}(?<server>\d{1,3}.\
string namePattern = @"\\{2}(?<server>[A-Za-z]+
string pattern = ipPattern + '|' + namePattern;
string server = "";
string drivePattern = pattern+@"";
string drive = "";
string filepath = "";
Match match = Regex.Match(input, pattern);
// Match match1 = Regex.Match(input, drivePattern);
if (match.Success)
{
server = match.Groups[
"server"].Value;
Console.WriteLine(server);
drive = match.Groups[
"drive"].Value;
Console.WriteLine(drive);
filepath = match.Groups[
"path"].Value;
Console.WriteLine(filepath
Console.WriteLine(drive.Re
}
else
{
Console.WriteLine("filepat
}
Main Topics
Browse All Topics





by: FernandoSotoPosted on 2006-02-20 at 17:06:03ID: 16004997
Hi praneetha;
l"; \.\d{1,3}\ .\d{1,3}\. \d{1,3})|( ?:.*?))\\( ?<Path>.*) ";
th"].Value , @"\$", ":");
This should do what you need.
namespace WindowsApplication5
string input = @"\\99.99.99.99\c$\test.xm
string pattern = @"\\\\(?<Server>(?:\d{1,3}
string servName;
string path;
Match m;
m = Regex.Match(input, pattern, RegexOptions.Multiline);
if ( m.Success )
{
servName = m.Groups["Server"].Value;
path = Regex.Replace(m.Groups["Pa
}
I hope that is is of some help.
Fernando