string text = "<title>张曼玉:错爱的前世今生 </title><link>http://www.cctv.com/tabloid/special/C20780/20080509/102559.shtml </link>";
string regexStr = @"<title>([^<]*)</title>";
string regexStr2 = @"<link>([^<]*)</link>";
Match mc = Regex.Match(text, regexStr, RegexOptions.IgnoreCase);
Match mc2 = Regex.Match(text, regexStr2, RegexOptions.IgnoreCase);
Response.Write(mc.Groups[1].Value);
Response.Write("</br>");
Response.Write(mc2.Groups[1].Value);注意引用using System.Text.RegularExpressions;

解决方案 »

  1.   

    使用一个Match完成提取:
    string text = "<title>张曼玉:错爱的前世今生 </title><link>http://www.cctv.com/tabloid/special/C20780/20080509/102559.shtml </link>";
    string regexStr = @"<title>([^<]*)</title><link>([^<]*)</link>";
    Match mc = Regex.Match(text, regexStr, RegexOptions.IgnoreCase);
    Response.Write(mc.Groups[1].Value);
    Response.Write("</br>");
    Response.Write(mc.Groups[2].Value);
      

  2.   

    使用一个Match完成提取:
    好象有问题啊
      

  3.   

    任意字符的正则表达式:
    ([^<]*)
    ([\w\W]*)
    ([\s\S]*)"\":将下一个字符标记为一个特殊字符、或一个原义字符、或一个 向后引用、或一个八进制转义符。
    "^":匹配输入字符串的开始位置。
    "*":匹配前面的子表达式零次或多次。
    "w":匹配包括下划线的任何单词字符。等价于'[A-Za-z0-9_]'。 
    "W":匹配任何非单词字符。等价于 '[^A-Za-z0-9_]'。
    "s":匹配任何空白字符,包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。 
    "S":匹配任何非空白字符。等价于 [^ \f\n\r\t\v]。 
      

  4.   

    那是没处理 </title> <link> 之间的东西
      

  5.   

    你从csdn上复制出来的string regexStr = @" <title>([^ <]*) </title> <link>([^ <]*) </link>"; 
    正则表达式有空格,把空格去掉。