diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php
index 420b5033..28a44cb2 100644
--- a/ext/bbcode/main.php
+++ b/ext/bbcode/main.php
@@ -38,7 +38,7 @@ class BBCode extends FormatterExtension {
$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text);
$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text);
$text = preg_replace("/\[s\](.*?)\[\/s\]/s", "\\1", $text);
- $text = preg_replace("/>>(\d+)(#\d+)?/s", ">>\\1\\2", $text);
+ $text = preg_replace("/>>(\d+)(#(\d+))?/s", ">>\\1\\2", $text);
$text = preg_replace("/(^|\s)#(\d+)/s", "\\1#\\2", $text);
$text = preg_replace("/>>([^\d].+)/", "
\\1", $text); $text = preg_replace("/\[url=((?:https?|ftp|irc|mailto):\/\/.*?)\](.*?)\[\/url\]/s", "\\2", $text);