I have two functions to format the text of my notices.
1. Converts [white-text][/white-text] into <font color=white></font>
$string = preg_replace("/\[white-text\](\S+?)\[\/white-text\]/si","<font color=white>\\1</font>", $string);
2. Converts [url][/url] into <a href></a>
$string = preg_replace("/\[url\](\S+?)\[\/url\]/si","<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $string);
Problems:
WHITE-TEXT - It only changes the color if the phrase has only ONE word.
URL - It works fine, but I would like to be able to write anything in the readable part of the URL.
(\S+?)to(.+?)-- but you will have problems with nested or overlapping tags. Why not simply replace[white-text]with<font color=white>and[/white-text]with</font>independently of each other to avoid nesting/overlap problems?fontelement has been deprecated. You should probably be usingspanelements with classes (or inline styles, if you really have to).