簡體   English   中英

PHP preg全部匹配

[英]PHP preg match all

$str = <a href="keep.php?casuser=400000018623110" onclick="ajaxLinkSend('globalContainer', 'keep.php?casuser=400000018623110'); return false;" style="color:#ffca3e">

我的工作准備符合所有條件:

preg_match_all('/\'keep.php\?casuser=(.*) style=\"color:#ffca3e/iU', $result, $matches2);
$matches2[1][0] = 400000018623110'); return false;"

但是我只想要數字

沒有結果:

preg_match_all('/\'keep.php\?casuser=(.*)\'\); return false;" style=\"color:#ffca3e/iU', $result, $matches2);

有人可以幫我嗎? 並解釋一下為什么它不起作用? 謝謝

對這個問題感到有點困惑-如果有代表,我會在評論中注明。

這足夠了嗎

preg_match_all('/\'keep.php\?casuser=(\d*)/i', $result, $matches2);

還是他們也要有相關的風格很重要? 如果是這樣,請嘗試:

preg_match_all('/\'keep.php\?casuser=(\d*).*?style=\"color:#ffca3e/i', $result, $matches2);

暫無
暫無

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

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