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! Link to comment https://forums.phpfreaks.com/topic/103966-regex-help/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/103966-regex-help/#findComment-532257 Share on other sites More sharing options...
kickassamd Posted May 3, 2008 Author Share Posted May 3, 2008 Ah gots it thank you! Link to comment https://forums.phpfreaks.com/topic/103966-regex-help/#findComment-532263 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.