10.用正则表达式 提取网页中的网站链接
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Text.RegularExpressions; namespace q提取网页中的网站链接 { class Program { static void Main(string[] args) { string str = File.ReadAllText("1.htm",Encoding.UTF8); MatchCollection ms = Regex.Matches(str,@"""(http://.+?)"""); if (ms.Count!=0) { for (int i = 0; i < ms.Count;i++ ) { if (ms[i].Success) { Console.WriteLine(ms[i].Groups[1].Value); } } } Console.ReadKey(); } } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- PostgreSQL启动过程中的那些事十五:加载客户端认证文件
- c – 为什么我不能使用Qt的QXmlStreamReader解析XML文件?
- GPDB管理员笔记(四)GP的起停
- 【PostgreSQL】 media-wiki的地址
- WARNING: erroneous pipeline: no element "ffdec_h264
- 可直接用于React Native开发各种加密标准的JavaScript库(MD
- ruby-on-rails – 你的rails应用程序在哪里?用什么用户部署
- Oracle JDBC异常消息语言是德语
- Swift 中的利刃,函数和闭包
- c# – LINQ to XML:查询主体必须以select子句或group子句结