PHP Regex - 使用多行在<p>标记之间获取文本

时间:2016-11-16 22:51:44

标签: php regex

我坚持这一点 - 试图从某些电子邮件HTML访问数据。

我得到所有单行信息 - 例如

    <P>Name: Warren Warren</P>
    <P>Email: warren@warren.com</P>
    <P>Phone: (03) 1234 7777</P>
    <P>Comments1:
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce aliquet purus ac ullamcorper condimentum. Interdum et malesuada fames ac ante ipsum primis in faucibus.
    </P>
    <P>Comments2: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce aliquet purus ac ullamcorper condimentum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nulla nec orci magna. Quisque facilisis aliquet massa eu feugiat. Mauris eleifend elit aliquet mi egestas, eu gravida augue tempus. Sed libero nunc, euismod non nisl nec, vehicula laoreet dolor. Suspendisse sed convallis diam, non porta arcu. </P>

<div class="legal" style="color:#888;margin-top:140px;font-size:12px">
    <p>Footer Text</p>

会从我这里得到电话号码:

{{1}}

此处的工作副本:https://regex101.com/r/6OZTO1/4

但我无法弄清楚如何从Comments1获取文本。我不太了解正则表达式多线修饰符和类似的东西。提前谢谢!

0 个答案:

没有答案