PDA

View Full Version : PHP Preg match this...



DesignerMichael
December 7th, 2008, 05:38 PM
I need a little help preg matching this... Anybody want to give me a hand? I want to preg match this out of my apache status pages to make one combined status page.

I just need the number at the start. The "35". I suck at regex...

So... My attempt would be... '/<dt>^[0-9]$.requests/' Help! lol


<dt>Server uptime: 1 hour 34 minutes 11 seconds</dt>
<dt>35 requests currently being processed, 4 idle workers</dt> </dl>
<pre>R_CRCRCCCCRCCRCR_..RWCCR_RCCCWC.R....RWCCC.C.._C.. ........R..... .................................................. ..............

joran420
December 7th, 2008, 07:41 PM
preg_match('<dt>([0-9]+)',$string,$vals);
print_r($vals);


I need a little help preg matching this... Anybody want to give me a hand? I want to preg match this out of my apache status pages to make one combined status page.

I just need the number at the start. The "35". I suck at regex...

So... My attempt would be... '/<dt>^[0-9]$.requests/' Help! lol


<dt>Server uptime: 1 hour 34 minutes 11 seconds</dt>
<dt>35 requests currently being processed, 4 idle workers</dt> </dl>
<pre>R_CRCRCCCCRCCRCR_..RWCCR_RCCCWC.R....RWCCC.C.._C.. ........R..... .................................................. ..............

DesignerMichael
December 7th, 2008, 07:45 PM
Sweet! Thanks... Btw, I had to change it to this: '/<dt>([0-9]+)/'

preg_match('<dt>([0-9]+)',$string,$vals);
print_r($vals);