RE: [PHP-DB] Exact String replace with eregi_replace()

2002-02-08 Thread Rick Emery

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:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 6:42 AM
To: [EMAIL PROTECTED]
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
  [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Exact String replace with eregi_replace()

2002-02-08 Thread Desikan

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 [EMAIL PROTECTED] said:
 To get is alone, use  is 
 
 -Original Message-
 From: Desikan [mailto:[EMAIL PROTECTED]]
 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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED]]
  Sent: Friday, February 08, 2002 6:42 AM
  To: [EMAIL PROTECTED]
  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
[EMAIL PROTECTED]
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 -- 
   Desikan
   [EMAIL PROTECTED]

-- 
  Desikan
  [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Exact String replace with eregi_replace()

2002-02-08 Thread Paul Burney

on 2/8/02 9:05 PM, Desikan at [EMAIL PROTECTED] appended the following
bits to my mbox:

 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

This kind of question really belongs on the PHP General List, since it isn't
db related.

That said, look at the preg_replace function:

http://www.php.net/manual/en/function.preg-replace.php

And use the \b escape in your search string:

http://www.php.net/manual/en/pcre.pattern.syntax.php

Paul

?php
while ($self != asleep) {
$sheep_count++;
}
?



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php