From fb2be9ac09889c9baf88358a216a13ed8b4a04a2 Mon Sep 17 00:00:00 2001 From: nginsburg Date: Mon, 13 Dec 2021 12:20:25 -0500 Subject: [PATCH] make regex not greedy so it only matches the first --- tags/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tags/plugin.py b/tags/plugin.py index 296b240..d2897ca 100644 --- a/tags/plugin.py +++ b/tags/plugin.py @@ -121,7 +121,7 @@ def get_metadata(name, path): """Get the metadata off of a file""" filename = Path(path) / Path(name) with filename.open() as fname: - match_string = search(r"\A\s*---\n.*\n---", fname.read(), flags=DOTALL | MULTILINE) + match_string = search(r"\A\s*---\n.*?\n---", fname.read(), flags=DOTALL | MULTILINE) if match_string: try: metadata = match_string.group(0).strip('---')