简体   繁体   English

PHP中的正则表达式提取分钟和秒值

[英]Regular expression in PHP to extract minutes and seconds values

I have the following section of HTML markup...我有以下 HTML 标记部分...

<div style="margin: 0px 0px 0px 157px; padding: 16px 0px 16px 0px;">
    <p class="sectionHdr">The page you requested is currently unavailable because the statistics are being updated.</p>
    <p class="sectionHdr">The statistics update will finish in about&nbsp;48 minutes 39 seconds.</p>
</div>

What's the PHP code to extract the minutes and seconds values using a regular expression please?请使用正则表达式提取分钟和秒值的 PHP 代码是什么?

I could do it with string manipulation, but I'd prefer to do it with a regular expression, I've just never been able to wrap my head around them!我可以用字符串操作来做到这一点,但我更喜欢用正则表达式来做到这一点,我只是一直无法理解它们!

Thanks to Robbie I've managed to figure out this will work... http://www.phpliveregex.com/p/iWb .感谢罗比,我设法弄清楚这会起作用...... http://www.phpliveregex.com/p/iWb

It's not quite as flexible as I was imagining, but it'll do the trick.它不像我想象的那么灵活,但它可以解决问题。

RegExp is:正则表达式是:

/(\d+) minutes (\d+) seconds/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM