求一正则表达式!

erbao78 2006-04-08 03:55:39
<DOCNO> AP880212-0013 </DOCNO>
<FILEID>AP-NR-02-12-88 1754EST</FILEID>
<FIRST>r w AM-Artukovic 02-12 0606</FIRST>
<SECOND>AM-Artukovic,590</SECOND>
<HEAD>Son Challenges Justice Department To Admit It Wrongly Extradited
Father</HEAD>
<BYLINE>By DAVID BRISCOE</BYLINE>
<BYLINE>Associated Press Writer</BYLINE>
<DATELINE>WASHINGTON (AP) </DATELINE>
<TEXT>
Artukovic said Yugoslavia accused his father of war crimes to
neutralize him as a Croatian political leader. He said most other
members of the Croatian wartime cabinet were executed as war
criminals but Allied officials found no evidence against him and he
was allowed to live freely in Ireland and later the United States.
</TEXT>



想把<DOCNO></DOCNO><FILEID></FILEID>。。。。。去掉


此正则表达式运行倒是行
$_ =~s/<.*?>(.*?)<\/.*?>/$1/g;
$_ =~s/<head>(.*?)<\/head>/$1/isg; #<head></head> 要换行!
$_ =~s/<text>(.*?)<\/text>/$1/isg; #<text></text>

但能否一个表达式能解决问题的???
...全文
283 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
michael_g_hu 2006-04-13
  • 打赏
  • 举报
回复
我说的是Python
supersuyogi 2006-04-13
  • 打赏
  • 举报
回复
应该是这样:
<(.*?)>.*?</\1>
michael_g_hu 2006-04-09
  • 打赏
  • 举报
回复
<.*?>(.*?)<.*?>这一行就行了啊,在查找得时候设为多行匹配就行了

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

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