From 3f83e0bc9fd05822b9c64fe143375f487deb079c Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Sun, 13 Sep 2015 22:31:46 -0400 Subject: [PATCH] Fix not fully replacing grok pattern to regex. see #5 --- pygrok/pygrok.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygrok/pygrok.py b/pygrok/pygrok.py index c164f40..cbe32e9 100644 --- a/pygrok/pygrok.py +++ b/pygrok/pygrok.py @@ -51,7 +51,7 @@ def grok_match(text, pattern, custom_patterns = {}, custom_patterns_dir = None): py_regex_pattern = re.sub(r'%{(\w+)}', lambda m: "(" + all_patterns[m.group(1)].regex_str + ")", py_regex_pattern) - if re.search('%{\w+}', py_regex_pattern) is None: + if re.search('%{\w+(:\w+)?}', py_regex_pattern) is None: break match_obj = re.search(py_regex_pattern, text)