• 获取字符串中含有超连接内容


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

  • 相关阅读:
    ajax全套
    url设计规范
    内置下划线方法
    rest_framework视图
    rest_framework
    数据库设置
    HDU 6231
    HDU 6242
    CodeForces 546D
    CodeForces 940E
  • 原文地址:https://www.cnblogs.com/springyangwc/p/1952765.html
Copyright © 2020-2023  润新知