I posted that tutorial when I was young and naive.

I dread to think how many problems there are with it.
Now that I'm older, a little more experienced and a lot more busy I know the value of using the labours of other people. More specifically in this case the work of one person, Stijn de Reede, who
posted a BBCode parser on the PEAR site.
Although I haven't yet used it, if I was putting together a forum script that's where I would start today. It might not be as fast as is possible but it's released as stable and given that he has been working on it since 2003 it seems fairly likely.
P.S. Hi to everyone, seems like an age since I last visited the site. I'll probably show my face again once summer really arrives.