Beh01der / node-grok

Regular expression template library for Node.js inspired by logstash grok filter module
ISC License
51 stars 32 forks source link

bug fix for the recursive pattern resolver #5

Closed Kosta-Github closed 9 years ago

Kosta-Github commented 9 years ago

bug fix for: https://github.com/Beh01der/node-grok/issues/1

I changed the resolver to first replace the grok patterns %{subPattern:fieldName} by the corresponding oniguruma named capture groups (?<fieldName>...) and then in a second pass create the fields array for all named capture groups taking the corresponding group nesting into account. Since there could be several unnamed capture groups as well, the fields array now contains null values for them. During the actual pattern parsing process these null fields are ignored.

I also added a bunch of additional unit tests in order to ensure the proper parsing of them.

Kosta-Github commented 9 years ago

Any chance to get that merged in?

Beh01der commented 9 years ago

Thanks Kosta, Appreciate your contribution :)