Re: Regex help

From: Date: Tue, 04 May 2004 15:20:19 +0000
Subject: Re: Regex help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185315@lists.php.net to get a copy of this message
* Thus wrote Brent Clark (bclark@equation.co.za): > Hi all > > Ive been trying to replace the "8" for the "netbios-node-type" > and for the likes of me I cant seem to get it right. > if someone could assist, it would be most appreciated > > # option netbios-dd-server 192.168.1.1; > option netbios-node-type 8; > range 192.168.178.221 192.168.178.224; $match = '/^(\s+option\s+netbios-node-type\s+)\d+;/m'; $replace = '$1 4;'; preg_replace($match, $replace, $contents); - Match from the begining of a line to avoid commented option - eleminate dependency of what kind of space is used. - Content inside the match () is defined in $1 of replace. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#185315) next »