RE: [PHP] ereg_replace

From: Date: Thu, 15 Feb 2001 17:16:44 +0000
Subject: RE: [PHP] ereg_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39945@lists.php.net to get a copy of this message
Ok, but I thought the start and end chars were ^ $ i.e., ^is$ or is this not what you mean by bounderies? ???? -confused... ;-) > -----Original Message----- > From: Robin Vickery [mailto:robin@planet-three.co.uk] > Sent: Thursday, February 15, 2001 11:06 AM > To: php-general@lists.php.net > Subject: Re: [PHP] ereg_replace > > > >>>>> "VB" == "Brian V Bonini" <brian@gfx.cncdsl.com> > >>>>> writes: > > > Ah right, strings not words, I feel like a dummy now... ;-) > > >> -----Original Message----- From: John Vanderbeck > >> [mailto:agathorn@cfl.rr.com] Sent: Thursday, February 15, 2001 > >> 10:57 AM To: brian@gfx.cncdsl.com; Robin Vickery; > >> php-general@lists.php.net Subject: Re: [PHP] ereg_replace > >> > > >> > $string = preg_replace( > >> > array( '/is/', '/string/' ), > >> > array( 'is not', 'bit of text' ), > >> > $string > >> > ); > > You could specify word boundaries on each side of your string > to get the behaviour you were expecting. > > $string = preg_replace( > array( '/\bis\b/', '/\bstring\b/' ), > array( 'is not', 'bit of text' ), > $string > ); > > -- > Robin Vickery................................................. > BlueCarrots, 14th Floor, 20 Eastbourne Terrace, London, W2 6LE > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#39945) next »