zoukankan      html  css  js  c++  java
  • c#从html中获取图片地址

     using System.Text.RegularExpressions;

    string ohtml = this.TextBox1.Text;
                System.Text.RegularExpressions.MatchCollection m;
                //提取字符串的图片
                m = Regex.Matches(ohtml, "(<img).*?>");
                for (int i = 0; i < m.Count; i++)
                {
                    string ostr = m[i].ToString();
                    //提取图片的地址
                    System.Text.RegularExpressions.MatchCollection m2;
                    m2 = Regex.Matches(ostr, "(src=)['|\"].*?['\"]");
                    for (int j = 0; j < m2.Count; j++)
                    {
                        string strTemp = m2[j].ToString();
                        strTemp = strTemp.Replace("src=", "");
                        strTemp = strTemp.Replace("\"", "");
                        strTemp = strTemp.Replace("'", "");
                        Response.Write(strTemp+ "<br>");
                    }
                }

  • 相关阅读:
    通信中的相干与非相干
    OFDM为什么要在频域内插后做fftshift
    OFDM为什么把高频子载波作为保护频带
    辛几何
    奇文共欣赏
    6G新技术
    高扇出导致的系统异常解决方法

    线程与守护线程
    进程之间的通行
  • 原文地址:https://www.cnblogs.com/wenming205/p/1489454.html
Copyright © 2011-2022 走看看