我想创建一个正则表达式来匹配标签之间的内容。
我无法运行的正则表达式:new RegExp("page.content_before(.+)\/page.content_before", "g").exec(myText)[0]
myText:
page.title
Accueil
/page.title
page.content_before
[slides]
<div>
<div class="line">
<div class="col-12">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit excepturi consequatur inventore alias ducimus tenetur libero iste nesciunt soluta esse et debitis aliquid, voluptatum placeat veritatis! At dolorem repellat doloremque!
</div>
</div>
</div>
<div>
<div class="line">
<div class="col-12">
[articles]
</div>
</div>
</div>
<div>
<div class="line">
<div class="col-12">
[vehicles]
</div>
</div>
</div>
/page.content_before
page.content
<div class="line">
<div class="col-8">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam officiis eos quis eum in sapiente aliquid placeat excepturi ratione suscipit quisquam exercitationem necessitatibus totam vel, ullam assumenda optio aspernatur incidunt.
</div>
<div class="col-4">
Social.
</div>
</div>
/page.content
page.content_after
[googlemap]
/page.content_after
page.seo_title
Accueil
/page.seo_title
page.seo_url
accueil
/page.seo_url
结果应为:
[slides]
<div>
<div class="line">
<div class="col-12">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit excepturi consequatur inventore alias ducimus tenetur libero iste nesciunt soluta esse et debitis aliquid, voluptatum placeat veritatis! At dolorem repellat doloremque!
</div>
</div>
</div>
<div>
<div class="line">
<div class="col-12">
[articles]
</div>
</div>
</div>
<div>
<div class="line">
<div class="col-12">
[vehicles]
</div>
</div>
</div>