diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e21887..1fe304f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # [develop](https://github.com/benlangfeld/ruby_speech) + * Bugfix: Fix grammar parsing error where MATCH_END is returned even when a partial match exists on a separate item # [3.0.0](https://github.com/benlangfeld/ruby_speech/compare/v2.4.0...v3.0.0) - [2018-07-10](https://rubygems.org/gems/ruby_speech/versions/3.0.0) * Feature: Loosen and bump Nokogiri version to ~>1.8, >=1.8.3 diff --git a/ext/ruby_speech/ruby_speech.c b/ext/ruby_speech/ruby_speech.c index ceaa818..867b619 100644 --- a/ext/ruby_speech/ruby_speech.c +++ b/ext/ruby_speech/ruby_speech.c @@ -48,9 +48,10 @@ static int is_match_end(pcre *compiled_regex, const char *input) search = search_set; } search_input[input_size] = *search++; - result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, 0, + result = pcre_exec(compiled_regex, NULL, search_input, input_size + 1, 0, PCRE_PARTIAL, ovector, sizeof(ovector) / sizeof(ovector[0])); if (result > -1) return 0; + if (result == PCRE_ERROR_PARTIAL) return 0; } return 1; }