簡體   English   中英

PHP中的正則表達式提取分鍾和秒值

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

我有以下 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>

請使用正則表達式提取分鍾和秒值的 PHP 代碼是什么?

我可以用字符串操作來做到這一點,但我更喜歡用正則表達式來做到這一點,我只是一直無法理解它們!

感謝羅比,我設法弄清楚這會起作用...... http://www.phpliveregex.com/p/iWb

它不像我想象的那么靈活,但它可以解決問題。

正則表達式是:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM