php - regex lenght of a list of numbers from a file -


hello want filter numbers file , way know regexp seems returned array empty. here how failed.txt looks like

015-05-12 18:57:11,4, modem1: sending sms (part 1/2) 40747984729 failed, trying time 98 sec. retries: 2. 2015-05-12 19:07:13,4, modem1: sending sms (part 1/2) 40731109381 failed, trying time 98 sec. retries: 2. 2015-05-12 19:14:16,4, modem1: sending sms (part 1/2) 40766368165 failed, trying time 104 sec. retries: 2. 2015-05-12 19:17:31,4, modem1: sending sms (part 1/2) 40755129209 failed, trying time 103 sec. retries: 2. 2015-05-12 19:20:41,4, modem1: sending sms (part 1/2) 40760015914 failed, trying time 103 sec. retries: 2. 2015-05-12 19:23:22,4, modem1: sending sms (part 1/2) 40763297631 failed, trying time 103 sec. retries: 2. 2015-05-12 19:28:52,4, modem1: sending sms (part 1/2) 40769564718 failed, trying time 103 sec. retries: 2. 2015-05-12 19:39:13,4, modem1: sending sms (part 1/2) 40722494529 failed, trying time 99 sec. retries: 2. 2015-05-12 19:44:43,4, modem1: sending sms (part 1/2) 40751013760 failed, trying time 103 sec. retries: 2. 2015-05-12 19:47:06,4, modem1: sending sms (part 1/2) 40766223398 failed, trying time 103 sec. retries: 2. 2015-05-12 19:49:01,4, modem1: sending sms (part 1/2) 40730263329 failed, trying time 106 sec. retries: 2. 2015-05-12 19:51:25,4, modem1: sending sms (part 1/2) 40784114631 failed, trying time 98 sec. retries: 2. 2015-05-12 19:53:59,4, modem1: sending sms (part 1/2) 40766844650 failed, trying time 98 sec. retries: 2. 

and here php code not working extract failed number

$regexp = '/^[0-9]{5,11}$/'; preg_match_all($regexp, file_get_contents('http://test.ro/failed.txt'), $keys, preg_pattern_order); $keys = array_unique($keys); var_dump($keys); 

replace anchors word boundary \b

$regexp = '/\b[0-9]{5,11}\b/'; 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -