There is a function to translate BBCode to HTML entities (PHP):
$patterns = array( '#\[b\](.*?)\[/b\]#', '#\[u\](.*?)\[/u\]#', '#\[strike\](.*?)\[/strike\]#', '#\[em\](.*?)\[/em\]#', ); $replacements = array( '<b>$1</b>', '<u>$1</u>', '<strike>$1</strike>', '<em>$1</em>', ); $text = preg_replace($patterns, $replacements, $text); How can I make the finished text processed using this function, when hit in <textarea> , changed back to BBCode?
That is, from lol <b>text 123</b> to the text engine should get lol [b]text123[/b] .
thank