很抱歉的冗餘,我問過這在我以前的問題在這裏:What's the regex to solve this problem?Regex修復此問題? [延伸]
這個問題是一個擴展:
從元件在以下的數組:
http://example.com/apps/1235554/
http://example.com/apps/apple/
http://example.com/apps/126734
http://example.com/images/a.jpg
我分離出apps/{number}/
和apps/{number}
使用:
foreach ($urls as $url)
{
if (preg_match('~apps/[0-9]+(/|$)~', $url)) echo $url;
}
現在,我怎樣才能將{number}
推到另一個具有相同正則表達式的數組?
按預期工作..謝謝! – Yeti 2010-06-17 13:16:09