Skip to content

Commit

Permalink
Fix not fully replacing grok pattern to regex. see #5
Browse files Browse the repository at this point in the history
  • Loading branch information
tmessi committed Sep 14, 2015
1 parent ad00afe commit 3f83e0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pygrok/pygrok.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3f83e0b

Please sign in to comment.