using preg_replace OR pre_replace_callback to replace new lines within bbcode
<p>I've written a bbcode parser that is basically called this way:</p>

<pre><code>echo nl2br(bb_parse($contents));
</code></pre>

<p>I'm updating the function to be ready for PHP 5.4+ by using preg_replace_callback instead of preg_replace with the e modifier.</p>

<pre><code>function strip_newline($text) 
{ 
     return preg_replace("/(\r\n|\r|\n)/", "", $text); 
}

bb_parse($text)
{
    $text = preg_replace("/\[ul\](.*)\[\/ul\]/Usie", '"&lt;ul class=\"forum_unordered\"&gt;".strip_newline("$1")."&lt;/ul&gt;"', $text);
    return $text;
}
</code></pre>

<p>I'm having trouble using preg_replace_callback to accomplish the same thing.</p>

<pre><code>bb_parse($text)
{
    $text = preg_replace_callback("/\[ol\](.*)\[\/ol\]/Usi", create_function('$matches', 'return preg_replace("/(\r\n|\r|\n)/", "", $matches);'), $text);
    return $text;
}
</code></pre>

<p>Any help would be greatly appreciated.  Thank you.</p>

<p><strong>Edit</strong></p>

<p>The code that bbcode that I wish to parse is this:</p>

<pre><code>[ol]
[li]One[/li]
[li]Two[/li]
[/ol]
</code></pre>

<p>My problem is that there are three line breaks between [ol] and [/ol] that I wish to remove.  Without removing the line breaks the output becomes this:</p>

<pre><code>1. One

2. Two
</code></pre>

<p>Instead of:</p>

<pre><code>1. One
2. Two
</code></pre>
