Got text a little like this coming out of a database
[color=#BF0000]This is just a very simple test.
Cheers Fred[/color]
Now this text could have newlines anywhere in it between the [color...] and [/color].
Been trying to use this regex within preg_replace, this is the pattern
\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[\/color\]/i
and gets replaced with
<span style=\"color:$1\">$2</span>
All works great if there are no newlines in the text. I know I need to make changes around (.*?) but no idea what, can anyone help with this?