<?php $text = <<< 'TXT' {ff0000}red tex {00ff00}green text TXT; echo preg_replace('~{([a-fA-F0-9]+)}((?>[^{]*{?(?!(?1)}))*)~', '<span style="color: #$1">$2</span>', $text);
You have javascript disabled. You will not be able to edit any code.