Re: String Replacement

From: Date: Mon, 15 Jan 2001 14:17:14 +0000
Subject: Re: String Replacement
References: 1 2 3  Groups: php.windows 
Request: Send a blank email to php-windows+get-5026@lists.php.net to get a copy of this message
yep, sorry. At 15:15 15.1. 2001, Daniel Beulshausen wrote the following: -------------------------------------------------------------- >At 14:57 15.01.2001 +0100, Cynic wrote: >>this one is really easy: >> >>$ret = preg_replace( '/(?!boy)s/' , 'girl' , $text ) ; > ><?php > $string = "boys, boy, fort boyard"; > $string = preg_replace("/boy(?!\w)/", "girl", $string); > print $string; >?> > >should be correct. > >daniel > > >>At 12:34 15.1. 2001, adam wrote the following: >>-------------------------------------------------------------- >>>Toby Butzon <php-lists@imawebdesigner.com> said: >>> >>>> lol... >>>> >>>> Ok, so you want to replace ONLY the word "boy" with the word >>>> "girl"... you >>>> don't want to touch "boys". >>>> >>>> Perhaps str_replace("boy ", "girl ", $myStr) would do the >>>> trick? >>>> >>>No, I thought of that - if the word is up against a fullstop or comma (or >>>something else), that won't work. A regular expression will need to be used, >>>and since I'm no good at them I can't make a suggestion. Sorry. :) >>> >>>adam >>> >>> >>>-- >>>PHP Windows Mailing List (http://www.php.net/) >>>To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net >>>For additional commands, e-mail: php-windows-help@lists.php.net >>>To contact the list administrators, e-mail: php-list-admin@lists.php.net >>------end of quote------ >> >> >> >>____________________________________________________________ >>Cynic: >> >>A member of a group of ancient Greek philosophers who taught >>that virtue constitutes happiness and that self control is >>the essential part of virtue. >> >>cynic@mail.cz >> >> >> >>-- >>PHP Windows Mailing List (http://www.php.net/) >>To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net >>For additional commands, e-mail: php-windows-help@lists.php.net >>To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >/*-- >daniel beulshausen - daniel@php4win.de >using php on windows? http://www.php4win.de > ------end of quote------ ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.windows (#5026) next »