在google上面看到的..也許有人有用..
<br>
<pre> ff
ccc
ddd
eee
11</pre>
<br>
<pre>jkjl</pre>
1.
print join ' '=>map{ chomp;$_} grep{/<pre>/..m{</pre>}} <DATA>;
會打印出
<pre> ff ccc ddd eee 11</pre> <pre>jkjl</pre>
2.不包含<pre></pre>
print join ' '=>map{chomp;$_} grep{/<pre>/..m{</pre>} and !/<pre>/ and !m{</pre>}} <DATA>;
打印出ccc ddd eee
3.不包含<pre></pre>
print join ' '=>map{chomp;$_} grep{$r=/<pre>/..m{</pre>} and $r>1 and $r!~/e/i}<DATA>;
打印出ccc ddd eee
4.不包含<pre></pre>
my @line=grep{/<pre>/..m{</pre>}} <DATA>;
chomp @line;
shift @line;
pop @line;
print join ' '=>@line;
打印出ccc ddd eee 11</pre>
四種方法都可以取出兩個TAG中間的Strings.....
但是第一種方式會保留TAG..其他不會..
這個用法應該蠻好用的才對...
改进
print join ' '=>map{chomp;s/.*?<pre>//;s!</pre>.*?!!;$_} grep{/<pre>/..m{</pre>}} <DATA>;
打印出 ff ccc ddd eee 11 jkjl
分享到:
相关推荐
2、使用前,请先将两个String.xml重命名为:strings_en.xml(英文或其他语言)和strings_zh.xml(中文); 3、此程序是通过strings_zh.xml去检索strings_en.xml中缺少的项,如果你觉得strings_en.xml的项多于...
strings.exe分析字符串
Format Strings
android strings
ns_strings_zh.xml
弦乐教程,action strings使用说明,影视游戏音乐制作利器
北大POJ3096-Surprising Strings 解题报告+AC代码
支持win10和XP的strings工具,可以用来扫描文件中包含的字符串
ns_strings_zh_storyline.xml
strings_zh.xml
本文档包准确,iPhone越狱后修改滑动解锁损坏SpringBoard.strings文件修复,此文件适用于ios7.1.2原生
通过静态分析来最大程度上的获取PE文件的信息,从而帮助我们了解其行为动态和作用方式,
pku acm 2406 Power Strings代码 kmp算法。解题报告:http://blog.csdn.net/china8848
William Smyth-Computing Patterns in Strings -Addison Wesley.djvu 0积分
从strings.xml文件中读取html标签示例代码eclipse工程.
基于jxl.jar解析Excel xls文件自动化生成android多语言strings.xml
.archLocalizable.strings
ns_strings_zh_platinum.xml
It’s often mentioned that one of the failings of the C language is the lack of a true string type, one that can be assigned, manipulated, and compared. Many early C++ books show how to define and use...