我想從這個字符串查找號碼:PHP中的字符串
request id is 16 (group id 1) for host localhost
而且JID號的狀態消息(在這種情況下Kill time expired
)
JID Pri S Owner Number Pages Dials Status
11 127 D root 0xxxxxx 1:1 1:12
16 116 F www-da 0xxxxxx 0:1 12:12 No carrier detected; too
15 127 D root 0xxxxxx 1:1 1:12
10 127 F root 0xxxxxx 0:0 0:12 Kill time expired
9 127 F root 0xxxxxx 0:0 0:12 Job aborted by request
8 127 F root 0xxxxxx 0:0 0:12 Job aborted by request
編輯:我設法解決了第一個問題。答案是(\d+)
。我需要提示第二次搜索。
[你有什麼嘗試](http://whathaveyoutried.com),你卡在哪裏? – deceze
@deceze我嘗試並在網上搜索了很多東西,但無法找到從字符串中獲取此類數字的方法。唯一最接近的是從字符串中去除所有數字。在這種情況下,有2個數字,我只需要第一個數字。 – xperator
然後對不起,但你還沒努力嘗試。你甚至可以用'substr'拼湊一些東西。你看過正則表達式嗎? – deceze