1. 要取得匹配的文本中, 指定的部分
在正则中使用()进行分组. 然后就可以取分组的内容了.
string BaseString = @"<input id=""ttt"" value=""1111111111"" /></div>";
            string 
pattern = @"<input id=""ttt""  value=""(?<MyValue>[^""]+)"" 
/>";   
            
Regex reg = new Regex(pattern, RegexOptions.IgnoreCase);    
            Match mac 
= 
reg.Match(BaseString);            
            string 
val = mac.Result("${MyValue}");    // 使用 mac.Group[“MyValue”] 
也可以, 这个会比较好理解一些吧..  这里使用了自定义分组.
不懂分组看: http://deerchao.net/tutorials/regex/regex.htm
原文:http://www.cnblogs.com/chencidi/p/3675681.html