Re: regex match

From: Date: Sat, 19 Apr 2003 16:14:52 +0000
Subject: Re: regex match
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144485@lists.php.net to get a copy of this message
can you give the results that would be returned for both systems? Jim ----- Original Message ----- From: "Chris Knipe" <savage@savage.za.org> To: <php-general@lists.php.net> Sent: Saturday, April 19, 2003 9:05 AM Subject: [PHP] regex match > Lo all, > > I need some quick help with a regex match... Mainly because of the fact that > the output between RH and FreeBSD is different for a command.... > > My output: > root@netsphere:/# /usr/bin/host -t soa abc.com 192.168.1.1 > Using domain server 192.168.1.1: > > abc.com start of authority ns01.blah some.email( > 2003041901 ;serial (version) > 10800 ;refresh period > 3600 ;retry refresh this often > 604800 ;expiration period > 10800 ;minimum TTL > ) > > the function: > function DigSerial($server,$zone) { > global $config; > $result = $config->binhost -t soa '$zone' > '$server'; > if(ereg("try again",$result)) { > return $result; > } else { > preg_match("/.*SOA [^\s\t]+ [^\s\t]+ ([^\s\t]+)/",$result,$serial); > if($serial[1]) { > return $serial[1]; > } else { > return 'not available'; > } > } > } > > Now, on RH, the function will work, seeing that RH's host -t returns the SOA > in one line... FreeBSD however doesn't... Any good regex's around for this? > I only need the serial number... Just the numbers. > > -- > me > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#144485) next »