You will need a BBCode Parser which will in reality by a Lexical Analyzer. Or, you could do it the easy way and search Google for a standalone BBCode parser for your particular language.