Re: case insensitive replace

From: Date: Mon, 08 Oct 2001 08:42:42 +0000
Subject: Re: case insensitive replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70326@lists.php.net to get a copy of this message
try this: <? $field = "sQl"; $what = 'testing 1 2 3'; $str = "[<a href=\"something\">$field</a>]"; $t = preg_replace("/(<a[^>]*>)(.+?)(<\/a>)/i", "$1$what$3", $str); print $t; ?> "Gregor Jaksa" <gre-gor@delphi-si.com> wrote in message news:20011006153822.84079.qmail@pb1.pair.com... > Hello, > I'm trying replace $field with "[<a > href="something">$field</a>]" in > $string, but here's the problem. > If $field is for example SQL then str_replace replaces only "SQL" not "Sql" > or "sql". I tried with preg_replace but i cant find any good solution. Can > anyone help me ? > > thx > >

« previous php.general (#70326) next »