diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php
index 42567098d9..c896c9f1c7 100644
--- a/phpBB/phpbb/textformatter/s9e/renderer.php
+++ b/phpBB/phpbb/textformatter/s9e/renderer.php
@@ -209,7 +209,7 @@ class renderer implements \phpbb\textformatter\renderer_interface
* @see bbcode::bbcode_second_pass_code()
*/
$html = preg_replace_callback(
- '#()(.*?)(
)#is',
+ '#(]*>)(.*?)(
)#is',
function ($captures)
{
$code = $captures[2];