<pre name="code" class="csharp"> Regex reg = new Regex(@"\((.*)\)"); string a = "张三(Zhang san)"; Match m = reg.Match(a); string yingwenname = m.Groups[1].Value; string f = yingwenname.Substring(0, yingwenname.IndexOf(" ") - 1);//名字,首 string l = yingwenname.Substring(yingwenname.IndexOf(" ") + 1, yingwenname.Length - yingwenname.IndexOf(" ") - 1);//名字结尾
m.Groups[0].Value等于<span style="font-family: Arial, Helvetica, sans-serif;">(Zhang san)</span>;
<pre name="code" class="csharp">m.Groups[1].Value等于<span style="font-family: Arial, Helvetica, sans-serif;">Zhang san</span>;