Skip to content

Commit

Permalink
Merge pull request #6 from shadowfax-chc/fix-replace-complex-patterns
Browse files Browse the repository at this point in the history
Fix not fully replacing grok pattern to regex. see #5
  • Loading branch information
garyelephant committed Oct 8, 2015
2 parents deff161 + 3f83e0b commit d8f9375
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 d8f9375

Please sign in to comment.