kickassamd Posted May 3, 2008 Share Posted May 3, 2008 Been trying to extract the kilobytes sent number from this string... Server Statistics for \\testbox Statistics since 5/2/2008 4:06 PM Sessions accepted 1 Sessions timed-out 0 Sessions errored-out 0 Kilobytes sent 16 Kilobytes received 17 Mean response time (msec) 0 System errors 0 Permission violations 0 Password violations 0 Files accessed 16 Communication devices accessed 0 Print jobs spooled 0 Times buffers exhausted Big buffers 0 Request buffers 0 The command completed successfully. ive tried Kilobytes sent [0-9] Kilobytes sent \d+ Kilobytes sent \d And i get no matches... preg_match('{Kilobytes sent \d+}', $this->_netStats, $matches); Any help is very appreciated! Quote Link to comment Share on other sites More sharing options...
sasa Posted May 3, 2008 Share Posted May 3, 2008 try <?php $a = 'Server Statistics for \\testbox Statistics since 5/2/2008 4:06 PM Sessions accepted 1 Sessions timed-out 0 Sessions errored-out 0 Kilobytes sent 16 Kilobytes received 17 Mean response time (msec) 0 System errors 0 Permission violations 0 Password violations 0 Files accessed 16 Communication devices accessed 0 Print jobs spooled 0 Times buffers exhausted Big buffers 0 Request buffers 0 The command completed successfully.'; preg_match('/Kilobytes sent\s+(\d+) Kilobytes received\s+(\d+)/', $a, $b); print_r($b); ?> Quote Link to comment Share on other sites More sharing options...
kickassamd Posted May 3, 2008 Author Share Posted May 3, 2008 Ah gots it thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.