正则表达式,提取两个标签之间的所有东西,怎么写?
<hr/><title>CONSTITUTIONOFTHESTATEOFCONNECTICUT</title><p>PREAMBLE.</p><p>Sec.1.Secti...
<hr />
<title>CONSTITUTION OF THE STATE OF CONNECTICUT</title>
<p>PREAMBLE.</p>
<p>Sec. 1. Section 25 of article fourth of the constitution is repealed.</p>
<p>Sec. 2. Subsection a. of article twenty-sixth of the amendments to the constitution is amended to
twenty-four hours prior to the time of convening of such special session. Such general assembly shall, upon roll call, by a yea vote of at least two-thirds of the membership of each house, adopt such plan of districting as is necessary to preserve a proper apportionment of representation in accordance with the principles recited in this article. Thereafter the general assembly shall decennially at its next regular session or special session called for the purpose of adopting a plan of districting following the completion of the taking of the census of the United States, upon roll call, by a yea vote of at least two-thirds of the membership of each house, adopt such plan of districting as is necessary in accordance with the provisions of this article.</p>
</article>
如何提取<hr />和</article>之间的所有内容,各位大侠帮忙写一个简单的~
不行啊楼下的几位,我用MTracer试了,还是匹配不上啊。。。。几个答案都试了。。。各位大侠再帮忙想象,就回车和空格的问题吧? 展开
<title>CONSTITUTION OF THE STATE OF CONNECTICUT</title>
<p>PREAMBLE.</p>
<p>Sec. 1. Section 25 of article fourth of the constitution is repealed.</p>
<p>Sec. 2. Subsection a. of article twenty-sixth of the amendments to the constitution is amended to
twenty-four hours prior to the time of convening of such special session. Such general assembly shall, upon roll call, by a yea vote of at least two-thirds of the membership of each house, adopt such plan of districting as is necessary to preserve a proper apportionment of representation in accordance with the principles recited in this article. Thereafter the general assembly shall decennially at its next regular session or special session called for the purpose of adopting a plan of districting following the completion of the taking of the census of the United States, upon roll call, by a yea vote of at least two-thirds of the membership of each house, adopt such plan of districting as is necessary in accordance with the provisions of this article.</p>
</article>
如何提取<hr />和</article>之间的所有内容,各位大侠帮忙写一个简单的~
不行啊楼下的几位,我用MTracer试了,还是匹配不上啊。。。。几个答案都试了。。。各位大侠再帮忙想象,就回车和空格的问题吧? 展开
4个回答
展开全部
最简单就可以:
1. /<hr[^>]*\/>.*<\/article>/is 这是正则的贪婪模式,提取<hr />和</article>之间的所有内容
2. 如果有多对 <hr />和</article>标签,而你只想要第一次出现的标签之间的内容,可以用非贪婪模式:
/<hr[^>]*\/>.*?<\/article>/is
后面的's'必须加入,这是个修正符,有's'则表达式中的'.'代表任何字符(包括回车!)
1. /<hr[^>]*\/>.*<\/article>/is 这是正则的贪婪模式,提取<hr />和</article>之间的所有内容
2. 如果有多对 <hr />和</article>标签,而你只想要第一次出现的标签之间的内容,可以用非贪婪模式:
/<hr[^>]*\/>.*?<\/article>/is
后面的's'必须加入,这是个修正符,有's'则表达式中的'.'代表任何字符(包括回车!)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<hr />(.|\n)*?</article>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<hr\/>(.|\n)*(?=<\/article>)
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询