Re: preg_replace (again)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
it's example script:

<?php
$string = "This is some _color:pink_ colored text _color_";

$patterns[0] = '/_color:(.*?)_/';
$patterns[1] = '/_color_/';
$replacements[0] = '<font color="$1">';
$replacements[1] = '</font>';

echo preg_replace($patterns, $replacements, $string);
?>

It should be ok, but i don't test it.

Pawel

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux