RE: [PHP] Case non-sensitive replacing with str_replace?
| From: | Miguel Cruz | Date: | Wed, 20 Mar 2002 05:27:18 +0000 |
| Subject: | RE: [PHP] Case non-sensitive replacing with str_replace? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89276@lists.php.net to get a copy of this message | ||
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