lundi 25 juillet 2016

Regex Pattern Needed

hope someone is able to help out finding this regex pattern: If i have this requests:

1-15    20241   0/0/6205    W   1.13    1071    0   0.0 0.00    11138.15    118.100.162.102 domain.com:443  GET /file/192493511503562/ HTTP/1.1

2-15    6252    0/130/6078  W   5.50    387 0   0.0 490.28  16798.43    14.33.181.155   domain.com:443  GET /file/720658522052690/ HTTP/1.1

3-14    9649    0/157/5992  G   4.37    1807    0   0.0 296.81  13625.69    212.252.56.41   domain.com:443  GET /file/512530584447085/ HTTP/1.1

I need to get those values:

20241   
192493511503562

6252  
720658522052690

9649
512530584447085 

So currently my preg_match_all looks like:

preg_match_all('@[0-9] (.*?) [0-9]/@si', $output, $url) ;  
foreach($url[1] as $output )  {  echo $output ; } 

How can i get both values? The current preg_match only echos the first value. So for example 20241 6252 .. etc. I tried this

preg_match_all('@[0-9] (.*?) [0-9]*/(.*?)/@si', $output, $url) ; 
foreach($url[0] as $output )  {   echo $output ; } 

but still not the result i want with [0]. Maybe some of your genuise people can help out.

Aucun commentaire:

Enregistrer un commentaire