package com.hspedu.regexp;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author 韩顺平
* @version 1.0
* 体验正则表达式的威力,给我们文本处理带来哪些便利
*/
public class Regexp_ {
public static void main(String[] args) {
//假定,编写了爬虫,从百度页面得到如下文本
// String content = "1995年,互联网的蓬勃发展给了Oak机会。业界为了使死板、单调的" +
// "静态网页能够“灵活”起来,急需一种软件技术来开发一种程序,这种程序可以通" +
// "过网络传播并且能够跨平台运行。于是,世界各大IT企业为此纷纷投入了大量的" +
// "人力、物力和财力。这个时候,Sun公司想起了那个被搁置起来很久的Oak,并且" +
// "重新审视了那个b站java基础入门用软件编写的试验平台,由于它是按照嵌入式系统硬件平台体系结" +
// "构进行编写的,所以非常小,特别适用于网络上的传输系统,而Oak也是一种精简的" +
// "语言,程序非常小,适合在网络上传输。Sun公司首先推出了可以嵌入网页并且可以" +
// "随同网页在网络上传输的Applet(Applet是一种将小程序嵌入到网页中进行执行的技术)," +
// "并将Oak更名为Java(在申请注册商标时,发现Oak已经被人使用了,再想了一系列" +
// "名字之后,最终,使用了提议者在喝一杯Java咖啡时无意提到的Java词" +
// "语)。5月23日,Sun公司在Sun world会议上正式发" +
// "布Java和HotJava浏览器。IBM、Apple、DEC、Adobe、HP、Oracle、Netscape和微软" +
// "等各大公司都纷纷停止了自己的相关开发项目,竞相购买了Java使用许可证,并为自己的产" +
// "品开发了相应的Java平台";
// String content = "<div class="cr-content new-pmd">
" +
// "
" +
// "<div class="FYB_RD">
" +
// " <div class="cr-title c-gap-bottom-xsmall" title="百度热榜">
" +
// " <span class="c-color-t">百度热榜</span>
" +
// " <div class="opr-toplist1-update opr-toplist1-link" data-click="{fm:'beha'}" style="position:relative;top:-1px;">
" +
// " <a class="OP_LOG_BTN toplist-refresh-btn c-font-normal c-color-gray2" href=https://download.csdn.net/download/weixin_47245590/"javascript:void(0);" style="text-decoration:none;">
" +
// " <i class="c-icon opr-toplist1-hot-refresh-icon"></i><span>换一换</span>
" +
// " </a>
" +
// " </div>
" +
// " </div>
" +
// " <table class="c-table opr-toplist1-table">
" +
// " <tbody >
" +
// " <tr class="toplist1-tr">
" +
// "
" +
// " <td class="toplist1-td opr-toplist1-link">
" +
// " <span class="toplist1-hot c-index-single toplist1-hot-top toplist1-hot-0 c-index-single-hot1 " style="opacity:1;">
" +
// " 1
" +
// " </span>
" +
// " <a target="_blank" title="印度累计确诊病例已超2000万例" href=https://download.csdn.net/download/weixin_47245590/"/s?wd=%E5%8D%B0%E5%BA%A6%E7%B4%AF%E8%AE%A1%E7%A1%AE%E8%AF%8A%E7%97%85%E4%BE%8B%E5%B7%B2%E8%B6%852000%E4%B8%87%E4%BE%8B&rsv_idx=2&tn=baiduhome_pg&usm=3&ie=utf-8&rsv_cq=%E5%91%A8%E6%98%9F%E9%A9%B0&rsv_dl=0_right_fyb_pchot_20811_01&rsv_pq=959254a60034f017&oq=%E5%91%A8%E6%98%9F%E9%A9%B0&rsv_t=abf2fwdknQ1VTZk3EzyT0N5%2FpcQzkjPt5GRZchjVdppW7k8B8oI6R5IL3T0myEMmjxXM&rsf=dd45f07d69719294a2ea6117b312f1d7_1_10_1" class="c-font-medium c-color-t opr-toplist1-subtitle">
" +
// " 印度累计确诊病例已超2000万例
" +
// " </a>
" +
// " </td>
" +
// " <td class="toplist1-right-num toplist1-td c-color-gray" style="line-height:20px;position:relative;top:2px;">473万</td>
" +
// " </tr>
" +
// " <tr class="toplist1-tr">
" +
// "
" +
// " <td class="toplist1-td opr-toplist1-link">
" +
// " <span class="toplist1-hot c-index-single toplist1-hot-top toplist1-hot-1 c-index-single-hot2 " style="opacity:1;">
" +
// " 2
" +
// " </span>
" +
// " <a target="_blank" title="五一酒店外卖订单涨2倍" href=https://download.csdn.net/download/weixin_47245590/"/s?wd=%E4%BA%94%E4%B8%80%E9%85%92%E5%BA%97%E5%A4%96%E5%8D%96%E8%AE%A2%E5%8D%95%E6%B6%A82%E5%80%8D&rsv_idx=2&tn=baiduhome_pg&usm=3&ie=utf-8&rsv_cq=%E5%91%A8%E6%98%9F%E9%A9%B0&rsv_dl=0_right_fyb_pchot_20811_01&rsv_pq=959254a60034f017&oq=%E5%91%A8%E6%98%9F%E9%A9%B0&rsv_t=32d1XGZJfky0Fpb6VgCcSv3Dnyp6JpbQ9TN%2BOvfioGkBC4T9m1Qp%2FFuwHnF9APvBaVr6&rsf=dd45f07d69719294a2ea6117b312f1d7_1_10_2" class="c-font-medium c-color-t opr-toplist1-subtitle">
" +
// " 五一酒店外卖订单涨2倍
" +
// " </a>
" +
// " <span class="c-text c-text-hot opr-toplist1-label">热</span>
" +
// " </td>
" +
// " <td class="toplist1-right-num toplist1-td c-color-gray" style="line-height:20px;position:relative;top:2px;">441万</td>
" +
// " </tr>
" +
// " <tr class="toplist1-tr">
" +
// "
" +
// " <td class="toplist1-td opr-toplist1-link">
" +
// " <span class="toplist1-hot c-index-single toplist1-hot-top toplist1-hot-2 c-index-single-hot3 " style="opacity:1;">
" +
// " 3
" +
// " </span>
" +
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.bianchenghao6.com/h6javajc/26433.html