static void Main(string[] args)
{
string test = "(3,'12','138','69','86',8090)";
string pattern = @"'(?<oct1>\d+)','(?<oct2>\d+)','(?<oct3>\d+)','(?<oct4>\d+)',(?<port>\d+)";
string url = "##";
if (Regex.IsMatch(test, pattern))
{
Match m = Regex.Match(test, pattern);
url = string.Format("{0}.{1}.{2}.{3}:{4}", m.Result("${oct1}"), m.Result("${oct2}"), m.Result("${oct3}"), m.Result("${oct4}"), m.Result("${port}"));
}
Console.WriteLine(url);
Console.ReadKey();
}
|