PHP 正则表达式 - 删除所有 <br> 标签

PHP Regex - Remove all <br> tag

我有一个功能

    function showBBcodes($text) {
  // BBcode array
  $find = array(
    '~\[b\](.*?)\[/b\]~s',
    '~\[i\](.*?)\[/i\]~s',
    '~\[u\](.*?)\[/u\]~s',
    '~\[quote\](.*?)\[/quote\]~s',
    '~\[size(.*?)\=(.*?)\](.*?)\[/size\]~s',
    '~\[color(.*?)\=(.*?)\](.*?)\[/color\]~s',
    '~\[url\]((?:ftp|https?)://.*?)\[/url\]~s',
    '~\[img\](https?://.*?\.(?:jpg|jpeg|gif|png|bmp))\[/img\]~s',
    '~\[b_id\](.*?)\[/b_id\]~s',
    '~\[tex\](.*?)\[/tex\]~s',
    '~\[sup\](.*?)\[/sup\]~s'
  );
  // HTML tags to replace BBcode
  $replace = array(
    '<span stype="font-weight: bold;">  </span>',
    '<i></i>',
    '<span style="text-decoration:underline;"></span>',
    '<pre></'.'pre>',
    '<span style="font-size:px;"></span>',
    '<span style="color:;"></span>',
    '<a class="blue-font" href=""></a>',
    '<a class="blue-font" href=""><img src="" alt=""></a>',
    '<sub></sub>',
    '<a class="blue-font" href="http://jabber.pozitiv-r.ru/cgi-bin/mathtex.cgi?"><img src="http://jabber.pozitiv-r.ru/cgi-bin/mathtex.cgi?" alt=""></a>',
    '<sup></sup>'
  );
  // Replacing the BBcodes with corresponding HTML tags
  return preg_replace($find,$replace,$text);
} 

我只需要从 [tex][/tex] 标签中删除所有 </br>。我厌倦了像 ^<br.*?>#s 那样修改我的正则表达式,但它不起作用。

尝试这样的事情^

$text = preg_replace_callback(
    '~\[tex\].*?\[/tex\]~s',
    function ($matches) {
        return preg_replace('~<br.*?>~', '', $matches[0]);
    },
    $text
);

return 语句之前添加代码。