Skip to content

Commit

Permalink
make regex not greedy so it only matches the first
Browse files Browse the repository at this point in the history
  • Loading branch information
nginsburg committed Dec 13, 2021
1 parent 6ee314c commit fb2be9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tags/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('---')
Expand Down

0 comments on commit fb2be9a

Please sign in to comment.