zoukankan      html  css  js  c++  java
  • 获取一段html代码img表情包含的src路径

            /// <summary>
            /// 获取所有img里面的src路径
            /// </summary>
            /// <param name="sHtmlText"></param>
            /// <returns></returns>
            public static string[] GetHtmlImageUrlList(string sHtmlText)
            {
                Regex regImg = new Regex(@"<img[^<>]*?src[s ]*=[s ]*[""']?[s ]*(?<imgUrl>[^s ""'<>]*)[^<>]*?/?[s ]*>");//img在IE里取出是大写 所以在Ie上面用户img替换成大写 或者html代码转换成小写
                MatchCollection matches = regImg.Matches(sHtmlText);
                int i = 0;
                string[] sUrlList = new string[matches.Count];
                foreach (Match match in matches)
                {
                    sUrlList[i++] = match.Groups["imgUrl"].Value;
                }
                return sUrlList;
            }

  • 相关阅读:
    Jquery所有获取对象
    使用VS Code 调试Vue
    Http请求
    Xml,Json序列化
    SqlServer函数使用
    FastReport关闭打印提示框
    求面试经验
    pyspark基于python虚拟环境运行
    idea配置本地spark本地开发环境
    carbondata使用总结
  • 原文地址:https://www.cnblogs.com/pjh7/p/5725753.html
Copyright © 2011-2022 走看看