diff --git a/foliant/preprocessors/escapecode.py b/foliant/preprocessors/escapecode.py
index 088882b..e5e6875 100644
--- a/foliant/preprocessors/escapecode.py
+++ b/foliant/preprocessors/escapecode.py
@@ -39,7 +39,7 @@ def __init__(self, *args, **kwargs):
self.content = None
self.pre_blocks_pattern = None
self._cache_dir_path = (self.project_path / self.options['cache_dir']).resolve()
- self.frontmatter_pattern = re.compile(r'^((-|\+){3})\n([\s\S]+?)\n((-|\+){3})([\s\S]*)')
+ self.frontmatter_pattern = re.compile(r'^((-|\+){3})\n([\s\S]*)\n((-|\+){3})([\s\S]*)')
self.logger = self.logger.getChild('escapecode')
diff --git a/tests/data/expected/frontmatter_yaml.md b/tests/data/expected/frontmatter_yaml.md
index 29586ce..4cf3169 100644
--- a/tests/data/expected/frontmatter_yaml.md
+++ b/tests/data/expected/frontmatter_yaml.md
@@ -4,12 +4,6 @@
# Test
-
-
----
-
-
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
diff --git a/tests/data/input/frontmatter_yaml.md b/tests/data/input/frontmatter_yaml.md
index e1d4385..1120396 100644
--- a/tests/data/input/frontmatter_yaml.md
+++ b/tests/data/input/frontmatter_yaml.md
@@ -6,16 +6,6 @@ tempor incididunt ut labore."
# Test
-```py
-import re
-```
-
----
-
-```py
-import os
-```
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo