<?php $message="I have a [red][car]"; echo preg_replace('/\[([^\]]+)]\[([^\]]+)]/',"<b style='color:$1'>$2</b>",$message);
Standard input is empty
I have a <b style='color:red'>car</b>
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!