Exact String replace with eregi_replace()

From: Date: Sat, 09 Feb 2002 02:05:20 +0000
Subject: Exact String replace with eregi_replace()
Groups: php.db 
Request: Send a blank email to php-db+get-16743@lists.php.net to get a copy of this message
Hi there, Please help me out in the following... <?php $is='is'; echo eregi_replace(" ".$is." "," ","This is a test string which contains is in dismissal"); ?> Actually I want to replace "is" alone from the string and not all the words that contains is... I have tried with "^".$is."$" ---> but yields nothing.... thanks and regards, Desikan On Fri, 8 Feb 2002 08:52:10 -0600 , "Rick Emery" <remery@excel.com> said: > To get "is" alone, use " is " > > -----Original Message----- > From: Desikan [mailto:desikb4u@fastmail.fm] > Sent: Friday, February 08, 2002 8:51 AM > To: Rick Emery > Subject: RE: [PHP-DB] Exact String replace with eregi_replace() > > > hi there, > > Actually ^string$ represents the exact match of the string alone, and not > words containg that sring... > > thanks > Desikan > > On Fri, 8 Feb 2002 08:46:32 -0600 , "Rick Emery" <remery@excel.com> said: > > First, the example you give will replace "is" with "," if > > "is" is the > > ONLY > > work in the line. You indicate this with the ^$ construct. > > > > Are you trying to replace only the first occurrence if "is"? > > > > -----Original Message----- > > From: Desikan [mailto:desikb4u@fastmail.fm] > > Sent: Friday, February 08, 2002 6:42 AM > > To: php-db@lists.php.net > > Subject: [PHP-DB] Exact String replace with eregi_replace() > > > > > > hi > > > > I'm trying to replace the exact match of 'is' with ','.. > > But all the matches of 'is' in the string gets replaced.... > > how can i avoid this??? > > > > <?php > > echo ereg_replace ("^is$", ",", "This is a dismissal of windows > > based technology"); > > ?> > > > > rgds, > > Desikan > > -- > > Desikan > > desikb4u@fastmail.fm > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > Desikan > desikb4u@fastmail.fm -- Desikan desikb4u@fastmail.fm

« previous php.db (#16743) next »