From 2ceaee1057633f88ab3a9ff88a813c7ed8117ac7 Mon Sep 17 00:00:00 2001 From: Simon Ungar Felding Date: Wed, 13 Nov 2024 16:46:16 +0100 Subject: [PATCH] check if there is a match at all --- pymdownx/snippets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymdownx/snippets.py b/pymdownx/snippets.py index f5ce8c0f6..e0ba3a626 100644 --- a/pymdownx/snippets.py +++ b/pymdownx/snippets.py @@ -104,7 +104,7 @@ def extract_regex(self, regex, lines): regex = re.match(r'^/(.*)/$', regex).group(1) # remove the slashes for line in lines: m = re.match(regex, line) - if m.groups(): + if m and m.groups(): new_lines.append(" ".join(re.match(nregex, line).groups())) # join the groups together elif m: new_lines.append(line)