我有一个xml文件作为文本文件以下内容:-在
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE dblp SYSTEM "dblp.dtd">
<dblp>
<article mdate="2011-01-11" key="journals/acta/Saxena96">
<author>Sanjeev Saxena</author>
<title>Parallel Integer Sorting and Simulation Amongst CRCW Models.</title>
<pages>607-619</pages>
<year>1996</year>
<volume>33</volume>
<journal>Acta Inf.</journal>
<number>7</number>
<url>db/journals/acta/acta33.html#Saxena96</url>
<ee>http://dx.doi.org/10.1007/BF03036466</ee>
</article>
<article mdate="2011-01-11" key="journals/acta/Simon83">
<author>Hans-Ulrich Simon</author>
<title>Pattern Matching in Trees and Nets.</title>
<pages>227-248</pages>
<year>1983</year>
<volume>20</volume>
<journal>Acta Inf.</journal>
<url>db/journals/acta/acta20.html#Simon83</url>
<ee>http://dx.doi.org/10.1007/BF01257084</ee>
</article>
如果我输入'Parallel',那么我应该得到,整个标题名,后跟'author'、'pages'、'year'、'volume'、'journal'
作为样本输出:
^{pr2}$如何使用regex执行上述操作?请帮忙!在
提前谢谢!在
改用XML解析器。在
使用^{} 的工作示例:
印刷品:
^{pr2}$解析}模块,但是作为替代,您可以使用以下模式:
xml
或html
文档的最佳方法是使用适当的html解析器,例如beautifulsoup
或{如果要从输入中获取单词,则需要以下额外命令:
^{pr2}$相关问题 更多 >
编程相关推荐