zoukankan      html  css  js  c++  java
  • 获取字符串中含有超连接内容

            private List<string> getURLFromContent(string content)
            {
                string regexStr = @"(http|ftp|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?・^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])";           

                System.Text.RegularExpressions.MatchCollection mc = System.Text.RegularExpressions.Regex.Matches(content, regexStr,               System.Text.RegularExpressions.RegexOptions.IgnoreCase);

                List<string> urlStr = new List<string>();
                for (int i = 0; i < mc.Count; i++)
                {
                    if(!urlStr.Contains(mc[i].ToString()))
                    {
                        urlStr.Add(mc[i].ToString());
                    }
                }
                return urlStr;
            }

  • 相关阅读:
    记坑
    常用模板
    ACM-东北赛划水记
    jzoj 4178游戏
    JZOI 4163
    jzoj 4146踩气球
    jzoj 5589. 缩点
    jzoj 5588 %%%
    jzoj 5571 ffs
    BJOI 2017 Kakuro
  • 原文地址:https://www.cnblogs.com/springyangwc/p/1952765.html
Copyright © 2011-2022 走看看