I wouldn't think anyone would likely use CoLoR.... seems silly.
Accounting for caps and lowercase makes some sense (overall, for the whole word), but just using one should be fine. Certainly using both would be fine, I think. I don't think you'd need to account for anything major.
You could do it by using--
PHP Code:
<?php
$string = //define this;
$srch = '[color=red]';
$rep = '<span color="red">';
$stlow = strtolower($string);
for ($pos = strpos($srch,$stlow,$pos+5)) {
$s1 = substr($string,0,$pos);
$s2 = $rep;
$s3 = substr($string,$pos+strlen($srch));
$string = $s1.$s2.$s3;
$stlow = strtolower($string);
}
echo $string; //now it's done
?>
That's untested, but I think is along the right lines.
Using regular expressions ("regex") might be very beneficial too if you want to look into something that complex. They basically allow you to search for patterns in the text.
Bookmarks