求一个正则

小白晒太阳 2014-04-17 01:41:59
    	<p class="MsoNormal" style="line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly"><span lang="EN-US" style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">2014</span><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">年<span lang="EN-US">4</span>月<span lang="EN-US">14-15</span>日,第十届全国大学生<span lang="EN-US">“</span>用友新道杯<span lang="EN-US">”</span>沙盘模拟经营大赛天津赛区决赛在我校管理学院举行,此次大赛由</span><span style="font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''">教育部工商管理类学科专业教学指导委员会指导、高等学校国家级实验教学示范中心联席会主办,</span><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">我校管理学院承办。</span><span lang="EN-US" style="font-size: 12pt"><o:p></o:p></span></p><p class="MsoNormal" style="line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly"><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">每年一度的沙盘模拟经营大赛,为大学生们提供零距离应用所学的机会,每个团队的五位参赛选手分别扮演总经理、财务总监、营销总监、生产总监、采购总监等角色,参赛团队通过完善的企业经营策略规划、进行科学的资金预算控制、制定精细的生产计划安排、运用熟练的市场营销技巧,依靠团队内各岗位出色的协作配合,才能使自己的企业在激烈的市场中脱颖而出,沙盘模拟经营大赛有效地促进学生创新思维和创新能力的培养。本届</span><span style="font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''">大赛受到我市各高校的高度重视,南开大学、天津大学、河北工业大学、天津财经大学等</span><span lang="EN-US" style="font-size: 12pt"><font face="Times New Roman">15</font></span><span style="font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''">所高校派出</span><span lang="EN-US" style="font-size: 12pt"><font face="Times New Roman">25</font></span><span style="font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''">支本科生团队参赛,参赛学校与团队数量均创历史最高。<br /></span></p><p class="MsoNormal" style="text-align: center; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly"><span style="font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''"><img alt="" src="http://www.tjpu.edu.cn/Files/2014/201404/2014041616540395287.jpg" /><br /></span><span style="font-size: smaller"><span style="font-family: 楷体_GB2312"><span style="mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''">                              图片来源:管理学院</span></span></span></p><p class="MsoNormal" style="line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly"><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">经过一天半的紧张激烈的比赛,通过为期六年的生产制造型企业模拟经营,天津工业大学二队、南开大学滨海学院队分别获一等奖;天津工业大学一队获得二等奖。这是我校连续七年获得该项赛事一等奖。<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" align="left" style="text-align: left; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan"><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">管理学院院长蔡为民、副院长马立群、用友新道岳向东总监、天津分公司经理蒋晓燕等领导和老师出席了闭幕式。蔡为民院长为一等奖获奖团队颁发了奖杯和奖牌,并发表了讲话。<br /></span></p><p class="MsoNormal" style="text-align: center; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan"><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><img alt="" src="http://www.tjpu.edu.cn/Files/2014/201404/2014041616540378646.jpg" /><br /><font size="2" face="楷体_GB2312">                                   图片来源:管理学院</font><br /></span></p><p class="MsoNormal" align="left" style="text-align: left; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan"><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">本届大赛期间,还举办了<span lang="EN-US">2014</span>年天津市高校经管专业实践教学研讨会,来自天津市企业、院校的领导和老师就企业对高校经营实践教学需求、实践育人提高高校实践教学质量等问题进行深入交流与研讨。<span lang="EN-US"><o:p></o:p></span></span></p><p class="MsoNormal" style="line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly"><span lang="EN-US" style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><span style="mso-spacerun: yes"> </span></span><span style="font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">此次大赛得到了学校教务处、经济学院等单位的大力支持与配合,我校<span lang="EN-US">MECLUB</span>大学生实践俱乐部成员协助完成大赛的筹备与组织工作。(编辑:宣传部 张蕾)</span><span lang="EN-US" style="font-size: 12pt"><o:p></o:p></span></p>


我想获取p标签里面的中文内容,请问正则该如何去写,求大神给写一个。感激不尽。
...全文
144 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
小白晒太阳 2014-04-17
  • 打赏
  • 举报
回复
<p.*?>(.*?)</p> 取p的这个我写出来了。。 搞定了,谢谢各位了。
小白晒太阳 2014-04-17
  • 打赏
  • 举报
回复
引用 2 楼 rui888 的回复:
String s=" <p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span lang=\"EN-US\" style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">2014</span><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">年<span lang=\"EN-US\">4</span>月<span lang=\"EN-US\">14-15</span>日,第十届全国大学生<span lang=\"EN-US\">“</span>用友新道杯<span lang=\"EN-US\">”</span>沙盘模拟经营大赛天津赛区决赛在我校管理学院举行,此次大赛由</span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">教育部工商管理类学科专业教学指导委员会指导、高等学校国家级实验教学示范中心联席会主办,</span><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">我校管理学院承办。</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><o:p></o:p></span></p><p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">每年一度的沙盘模拟经营大赛,为大学生们提供零距离应用所学的机会,每个团队的五位参赛选手分别扮演总经理、财务总监、营销总监、生产总监、采购总监等角色,参赛团队通过完善的企业经营策略规划、进行科学的资金预算控制、制定精细的生产计划安排、运用熟练的市场营销技巧,依靠团队内各岗位出色的协作配合,才能使自己的企业在激烈的市场中脱颖而出,沙盘模拟经营大赛有效地促进学生创新思维和创新能力的培养。本届</span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">大赛受到我市各高校的高度重视,南开大学、天津大学、河北工业大学、天津财经大学等</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><font face=\"Times New Roman\">15</font></span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">所高校派出</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><font face=\"Times New Roman\">25</font></span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">支本科生团队参赛,参赛学校与团队数量均创历史最高。<br /></span></p><p class=\"MsoNormal\" style=\"text-align: center; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\"><img alt=\"\" src=\"http://www.tjpu.edu.cn/Files/2014/201404/2014041616540395287.jpg\" /><br /></span><span style=\"font-size: smaller\"><span style=\"font-family: 楷体_GB2312\"><span style=\"mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">                              图片来源:管理学院</span></span></span></p><p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">经过一天半的紧张激烈的比赛,通过为期六年的生产制造型企业模拟经营,天津工业大学二队、南开大学滨海学院队分别获一等奖;天津工业大学一队获得二等奖。这是我校连续七年获得该项赛事一等奖。<span lang=\"EN-US\"><o:p></o:p></span></span></p><p class=\"MsoNormal\" align=\"left\" style=\"text-align: left; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">管理学院院长蔡为民、副院长马立群、用友新道岳向东总监、天津分公司经理蒋晓燕等领导和老师出席了闭幕式。蔡为民院长为一等奖获奖团队颁发了奖杯和奖牌,并发表了讲话。<br /></span></p><p class=\"MsoNormal\" style=\"text-align: center; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\"><img alt=\"\" src=\"http://www.tjpu.edu.cn/Files/2014/201404/2014041616540378646.jpg\" /><br /><font size=\"2\" face=\"楷体_GB2312\">                                   图片来源:管理学院</font><br /></span></p><p class=\"MsoNormal\" align=\"left\" style=\"text-align: left; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">本届大赛期间,还举办了<span lang=\"EN-US\">2014</span>年天津市高校经管专业实践教学研讨会,来自天津市企业、院校的领导和老师就企业对高校经营实践教学需求、实践育人提高高校实践教学质量等问题进行深入交流与研讨。<span lang=\"EN-US\"><o:p></o:p></span></span></p><p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span lang=\"EN-US\" style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\"><span style=\"mso-spacerun: yes\"> </span></span><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">此次大赛得到了学校教务处、经济学院等单位的大力支持与配合,我校<span lang=\"EN-US\">MECLUB</span>大学生实践俱乐部成员协助完成大赛的筹备与组织工作。(编辑:宣传部 张蕾)</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><o:p></o:p></span></p>";
     	System.out.println(s.replaceAll("<(.[^>]*)>", ""));;
确实可以,请问页面中这个p标签,就是我给的这一大串内容怎么获取。我题目没说清楚。。求大神再给个正则取我发的这内容。
小白晒太阳 2014-04-17
  • 打赏
  • 举报
回复
引用 5 楼 taxuelingbing 的回复:
就一行 看起来好费劲 用xpath 好点吧 也看不出来这个层叠关系, "//p[@class="MsoNormal"]/span"大概就这样,然后用gettext方法
我也不知道为什么不给我自动换行。。所以我贴了个截图,可惜又太小。。
机器学习之禅 2014-04-17
  • 打赏
  • 举报
回复
就一行 看起来好费劲 用xpath 好点吧 也看不出来这个层叠关系, "//p[@class="MsoNormal"]/span"大概就这样,然后用gettext方法
冰思雨 2014-04-17
  • 打赏
  • 举报
回复
如果是标准的XML,就解析一下,提取内容。如果不是就另想办法吧。
小酷 2014-04-17
  • 打赏
  • 举报
回复
楼主这代码是从pdf文件获取的?
tony4geek 2014-04-17
  • 打赏
  • 举报
回复
String s=" <p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span lang=\"EN-US\" style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">2014</span><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">年<span lang=\"EN-US\">4</span>月<span lang=\"EN-US\">14-15</span>日,第十届全国大学生<span lang=\"EN-US\">“</span>用友新道杯<span lang=\"EN-US\">”</span>沙盘模拟经营大赛天津赛区决赛在我校管理学院举行,此次大赛由</span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">教育部工商管理类学科专业教学指导委员会指导、高等学校国家级实验教学示范中心联席会主办,</span><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">我校管理学院承办。</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><o:p></o:p></span></p><p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">每年一度的沙盘模拟经营大赛,为大学生们提供零距离应用所学的机会,每个团队的五位参赛选手分别扮演总经理、财务总监、营销总监、生产总监、采购总监等角色,参赛团队通过完善的企业经营策略规划、进行科学的资金预算控制、制定精细的生产计划安排、运用熟练的市场营销技巧,依靠团队内各岗位出色的协作配合,才能使自己的企业在激烈的市场中脱颖而出,沙盘模拟经营大赛有效地促进学生创新思维和创新能力的培养。本届</span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">大赛受到我市各高校的高度重视,南开大学、天津大学、河北工业大学、天津财经大学等</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><font face=\"Times New Roman\">15</font></span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">所高校派出</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><font face=\"Times New Roman\">25</font></span><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">支本科生团队参赛,参赛学校与团队数量均创历史最高。<br /></span></p><p class=\"MsoNormal\" style=\"text-align: center; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span style=\"font-family: 宋体; font-size: 12pt; mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\"><img alt=\"\" src=\"http://www.tjpu.edu.cn/Files/2014/201404/2014041616540395287.jpg\" /><br /></span><span style=\"font-size: smaller\"><span style=\"font-family: 楷体_GB2312\"><span style=\"mso-ascii-font-family: ''Times New Roman''; mso-hansi-font-family: ''Times New Roman''\">                              图片来源:管理学院</span></span></span></p><p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">经过一天半的紧张激烈的比赛,通过为期六年的生产制造型企业模拟经营,天津工业大学二队、南开大学滨海学院队分别获一等奖;天津工业大学一队获得二等奖。这是我校连续七年获得该项赛事一等奖。<span lang=\"EN-US\"><o:p></o:p></span></span></p><p class=\"MsoNormal\" align=\"left\" style=\"text-align: left; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">管理学院院长蔡为民、副院长马立群、用友新道岳向东总监、天津分公司经理蒋晓燕等领导和老师出席了闭幕式。蔡为民院长为一等奖获奖团队颁发了奖杯和奖牌,并发表了讲话。<br /></span></p><p class=\"MsoNormal\" style=\"text-align: center; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\"><img alt=\"\" src=\"http://www.tjpu.edu.cn/Files/2014/201404/2014041616540378646.jpg\" /><br /><font size=\"2\" face=\"楷体_GB2312\">                                   图片来源:管理学院</font><br /></span></p><p class=\"MsoNormal\" align=\"left\" style=\"text-align: left; line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; background: white; mso-char-indent-count: 2.0; mso-line-height-rule: exactly; mso-pagination: widow-orphan\"><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">本届大赛期间,还举办了<span lang=\"EN-US\">2014</span>年天津市高校经管专业实践教学研讨会,来自天津市企业、院校的领导和老师就企业对高校经营实践教学需求、实践育人提高高校实践教学质量等问题进行深入交流与研讨。<span lang=\"EN-US\"><o:p></o:p></span></span></p><p class=\"MsoNormal\" style=\"line-height: 22pt; text-indent: 24pt; margin: 0cm 0cm 0pt; mso-char-indent-count: 2.0; mso-line-height-rule: exactly\"><span lang=\"EN-US\" style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\"><span style=\"mso-spacerun: yes\"> </span></span><span style=\"font-family: 宋体; font-size: 12pt; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt\">此次大赛得到了学校教务处、经济学院等单位的大力支持与配合,我校<span lang=\"EN-US\">MECLUB</span>大学生实践俱乐部成员协助完成大赛的筹备与组织工作。(编辑:宣传部 张蕾)</span><span lang=\"EN-US\" style=\"font-size: 12pt\"><o:p></o:p></span></p>";
     	System.out.println(s.replaceAll("<(.[^>]*)>", ""));;
小白晒太阳 2014-04-17
  • 打赏
  • 举报
回复

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧