你这是字符川还是本身从xml文档中取值呢

解决方案 »

  1.   

    你试一下这个:str = System.Text.RegularExpressions.Regex.Replace(str, "<[^<>]*>", " ", System.Text.RegularExpressions.RegexOptions.IgnoreCase);str = System.Text.RegularExpressions.Regex.Replace(str, "\s+", " ", System.Text.RegularExpressions.RegexOptions.IgnoreCase);string [] sa = str.Split(" ".ToCharArray());
      

  2.   

    Regex weatherRegex=new Regex(@"(?<=<td[^>]*?>)(?<content>.*?)(?=</td>)",RegexOptions.None);
    string weather="<td width=54 rowspan=1 >北京</td> <td  height=25>北京</td>  <td>雷阵雨</td> <td> ≤3</td> <td>25 ℃</td> <td>阴</td> <td> ≤3</td> <td>32 ℃</td>";
    MatchCollection weatherMatches=weatherRegex.Matches(weather);
    foreach(Match weatherMatch in weatherMatches)
    {
        GroupCollection weatherGroups=weatherMatch.Groups;
    Console.WriteLine(weatherGroups["content"].Value);
    }
      

  3.   

    把以<开始 >结束的字符串都删掉就得到了