日期:2014-05-18 浏览次数:20772 次
string s = "our address is: 9 (2): 86-91"; Match match = Regex.Match(s, @"our address is:\s*(\d+)\s*\((\d+)\):\s*([0-9\-]+)"); string r = string.Format(@"our address is district {0}, no. {1}, block {2}", match.Groups[1].Value, match.Groups[2].Value, match.Groups[3].Value); Console.Write(r); Console.ReadKey();