diff --git a/include/bbcode.php b/include/bbcode.php
index cff26f5c8..d69cb263f 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -216,6 +216,9 @@ function bbcode($Text,$preserve_nl = false) {
$Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '', $Text);
+ $Text = preg_replace("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", '', $Text);
+
+ $Text = preg_replace("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3))\[\/audio\]/ism", '', $Text);
// Try to Oembed
$Text = preg_replace_callback("/\[video\](.*?)\[\/video\]/ism", 'tryoembed', $Text);
@@ -224,9 +227,6 @@ function bbcode($Text,$preserve_nl = false) {
// html5 video and audio
- $Text = preg_replace("/\[video\](.*?)\[\/video\]/ism", '', $Text);
-
- $Text = preg_replace("/\[audio\](.*?)\[\/audio\]/ism", '', $Text);
$Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '', $Text);