Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中的正则表达式,用于提取分钟和秒值_Php_Regex - Fatal编程技术网

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

PHP中的正则表达式,用于提取分钟和秒值,php,regex,Php,Regex,我有下面的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"&

我有下面的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>

您请求的页面当前不可用,因为统计信息正在更新

统计数据更新将在大约48分39秒后完成

请问,使用正则表达式提取分钟和秒值的PHP代码是什么


我可以用字符串操作来完成,但我更喜欢用正则表达式,我只是从来没有想过要用正则表达式

多亏了Robbie,我终于想出了这个办法

它不像我想象的那么灵活,但它会起作用的

RegExp是:

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

像这样的?我希望把“48”和“39”分开,如果可能的话?像这样?你自己到底尝试了什么?看起来也会奏效。我把自己绑得死死的,不知到哪里去了,所以我问。很高兴你找到了解决办法。您应该使用
+
来匹配至少一个数字,而不是匹配零个或多个数字的
*
——此外,您还应该将您找到的解决问题的正则表达式作为答案的一部分发布:)