[PHP] Re: case insensitive replace From: _lallous (elias_bachaalany <email protected>)
Date: 10/08/01

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 <email protected>> wrote in message
news:20011006153822.84079.qmail <email protected>
> 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
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>