<table style="border-collapse: collapse" bordercolor="#111111" cellspacing="0" cellpadding="0" width="610" border="1" align="center">
  <tr>
    <td>   </td>
  </tr>
</table>
</P>
<IMG title="123" src=\"http://192.19.19.43/test.gif" align=left>
</P>
<P>&nbsp;456</P>结果:123456——————————————
忽略所有html标记  除<IMG>的title值

解决方案 »

  1.   

    trystring result = Regex.Replace(yourStr, @"<img[^>]*title=(['""]?)(?<title>[^'""]*)\1?[^>]*>", "${title}", RegexOptions.IgnoreCase);
    result = Regex.Replace(result, @"(<[^>]*>|\s|&nbsp;)", "");
      

  2.   

    orstring yourStr = ..............;
    string  result = Regex.Replace(yourStr, @"(<img[^>]*title=(['""]?)(?<title>[^'""]*)\1?[^>]*>|<[^>]*>|\s|&nbsp;)", "${title}", RegexOptions.IgnoreCase);
      

  3.   

    123 ---title=\"(?<name>.+).{2}src
    456 ---&(?<name>.+)</p>
    拼起来就是123456了