zoukankan      html  css  js  c++  java
  • C# 正则域名

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Text.RegularExpressions;

    namespace rexurl
    {
        class Program
        {
            static void Main(string[] args)
            {
                string regex = @"(?i)http://(\w+\.){2,3}(com(\.cn)?|cn|net)\b";
                string content = "http://www.17meiman.com/u/20090313/15/5ad5d3f2-094f-4b01-9c91-a6d4052a8255.html";
                Regex re1 = new Regex(regex);
                MatchCollection matches = re1.Matches(content);
                System.Collections.IEnumerator enu = matches.GetEnumerator();

                while (enu.MoveNext() && enu.Current != null)
                {

                    Match match = (Match)(enu.Current);
                    string str = match.Value;
                    Console.Write(str);

                }
                Console.Read();
            }
        }
    }

  • 相关阅读:
    Sort
    MyOD
    Linux C语言编程基础(必做)
    团队作业(一):团队展示
    2.3.1测试
    《Unix/Linux系统编程》第四章学习笔记
    课堂测试2
    课堂测试
    第三章 Unix/Linux进程管理学习笔记
    团队作业(二):需求分析
  • 原文地址:https://www.cnblogs.com/wangchuang/p/2508669.html
Copyright © 2011-2022 走看看