diff --git a/mod/wiki/parser/markups/html.php b/mod/wiki/parser/markups/html.php
index 90d79343fce..26961b882c8 100644
--- a/mod/wiki/parser/markups/html.php
+++ b/mod/wiki/parser/markups/html.php
@@ -74,7 +74,7 @@ class html_parser extends nwiki_parser {
$h1 = array("<\s*h{$minheaderlevel}\s*>", "<\/h{$minheaderlevel}>");
- $regex = "/(.*?)({$h1[0]}\s*".preg_quote($header, '/')."\s*{$h1[1]}.*?)((?:\n{$h1[0]}.*)|$)/is";
+ $regex = "/(.*?)({$h1[0]}\s*".preg_quote($header, '/')."\s*{$h1[1]}.*?)((?:{$h1[0]}.*)|$)/is";
preg_match($regex, $text, $match);
if (!empty($match)) {