Re: ereg_replace

From: Date: Thu, 15 Feb 2001 17:09:48 +0000
Subject: Re: ereg_replace
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-39954@lists.php.net to get a copy of this message
>>>>> "VB" == "Brian V Bonini" <brian@gfx.cncdsl.com> >>>>> writes: > Ok, but I thought the start and end chars were ^ $ i.e., ^is$ or is > this not what you mean by bounderies? No, not really. \b matches the start or end of a word. You can see it clearly if you do this: print preg_replace( '/\b/', '-', 'this is a string' ) . "<br>\n"; It will output: -this- -is- -a- -string- As it replaces all the word boundaries with a hyphen. So the regular expression /\bis\b/ will match only the word 'is' and not 'this' or 'isotope' or 'biscuit'. -robin -- Robin Vickery................................................. BlueCarrots, 14th Floor, 20 Eastbourne Terrace, London, W2 6LE

« previous php.general (#39954) next »