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>");
                    }
                }

  • 相关阅读:
    CF351A Jeff and Rounding 思维
    CF352B Jeff and Periods 模拟
    CF352A Jeff and Digits
    小B的询问 莫队分块
    小凯的疑惑 数学
    BestCoder Round #80 待填坑
    [SDOI2009]HH的项链 树状数组 BZOJ 1878
    Blocks poj 区间dp
    [USACO5.4]奶牛的电信Telecowmunication 最小割
    数位dp
  • 原文地址:https://www.cnblogs.com/wenming205/p/1489454.html
Copyright © 2011-2022 走看看