[PHP] Case non-sensitive replacing with str_replace?

2002-03-19 Thread Leif K-Brooks

I'm doing some replacing with str_replace, but it's case sensitive.  Is
there any way to make it not case-sensitive?


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




RE: [PHP] Case non-sensitive replacing with str_replace?

2002-03-19 Thread Martin Towell

use ereg_ireplace() or preg_ireplace() (the latter I'm not sure exists, but
the former function does)

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 4:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Case non-sensitive replacing with str_replace?


I'm doing some replacing with str_replace, but it's case sensitive.  Is
there any way to make it not case-sensitive?


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

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




RE: [PHP] Case non-sensitive replacing with str_replace?

2002-03-19 Thread Miguel Cruz

On Wed, 20 Mar 2002, Martin Towell wrote:
 use ereg_ireplace() or preg_ireplace() (the latter I'm not sure exists,
 but the former function does)

Close - it's eregi_replace().

To use preg_replace case-insensitively, just toss an 'i' at the end of 
your pattern. Instead of:

   preg_replace('/abc/', 'def', $x);

use

   preg_replace('/abc/i', 'def', $x);

miguel


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




Re: [PHP] Case non-sensitive replacing with str_replace?

2002-03-19 Thread Leif K-Brooks

on 3/20/02 12:24 AM, Martin Towell at [EMAIL PROTECTED] wrote:

use ereg_ireplace() or preg_ireplace() (the latter I'm not sure exists, but
the former function does)

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 4:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Case non-sensitive replacing with str_replace?


I'm doing some replacing with str_replace, but it's case sensitive.  Is
there any way to make it not case-sensitive?

First of all, the function is eregi_replace(), not ereg_ireplace(). Anyway,
that one goes slower because it has regular expressions.  Is there any
function that does't have regular expressions, but isn't case sensitive?