惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - 星答

win7 小版本号16384( 最终测试版) 两个参数互换(不用第三个变量) c#实现九九乘法表 Excel导入导出 .net 6年之感想 服务器配置之DNS .net 杂记 asp.net 导出CSV Powerdesigner反向工程 常用时间函数 无任何网络提供程序接受指定的网络路径 虚拟机拖拽 sql表的所有者 奥运门票有了 阿泰斯特乘火箭 sql脚本导入Powerdesigner C# 上传文件 - 星答 - 博客园 'f_split' 不是可以识别的 函数名 加载App_Licenses出错
24券 域名
星答 · 2011-07-27 · via 博客园 - 星答

  昨天晚上去24券聊了一下,有个哥们问个问题很逗

     http://www.24quan.com/beijing.html

   说要取出24quan.com这个域名怎么做,我觉得很简单,没有什么好说的,

  正则匹配,取出第一个.开始到倒数第一个/中间的就可以了,如果没有/就从最后面取到第一个.

  不知道他要问这种问题干嘛?

  借此机会,复习一下域名的相关知识

  顶级域名:

  .COM - -适用于商业实体,它是最流行的顶级域名,任何人都可注册一个.com域名。
  .NET - -最初用于网络机构如ISP,今天,任何一个人都可注册一个.net域名。
  .ORG ---设计是用于各类组织机构,包括非盈利团体,今天,任何一个人都可注册一个.org域名

  举例说明:http://www.sohu.com

  一级域名就是sohu.com

  类似news.sohu.com,tuan.sohu.com就是二级域名

贴出c#代码

string sohuurl = "http://www.sohu.com";//截取sohu.com
            string sinaUrl = "http://news.sina.com.cn";
            var regex = @"[\w][\w-]*\.(?:com\.cn|com|cn|co|net|org|gov|cc|biz|info)";

            Regex Reg = new Regex(regex);
            Match sohu = Reg.Match(sohuurl);
            Match sina = Reg.Match(sinaUrl);
            if (sohu.Success)
           {
               Console.Write(sohu.ToString());
           }
            if(sina.Success )
            {
                Console.Write("\n");
                Console.Write(sina.ToString());
            }
            Console.Read();