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 > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "not match end\n");
return 0;
}
+ if (result == PCRE_ERROR_PARTIAL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "partial match possible - not match end\n");
+ return 0;
+ }
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "is match end\n");
return 1;
" <one-of>\n"
" <item><tag>0</tag>1</item>\n"
" <item><tag>1</tag>5</item>\n"
- " <item><tag>2</tag>7</item>\n"
+ " <item><tag>7</tag>7</item>\n"
" <item><tag>3</tag>9</item>\n"
+ " <item><tag>4</tag>715</item>\n"
" </one-of>\n"
" </rule>\n"
"</grammar>\n";
ASSERT_STRING_EQUALS("1", interpretation);
ASSERT_EQUALS(SMT_NO_MATCH, srgs_grammar_match(grammar, "6", &interpretation));
ASSERT_NULL(interpretation);
- ASSERT_EQUALS(SMT_MATCH_END, srgs_grammar_match(grammar, "7", &interpretation));
- ASSERT_STRING_EQUALS("2", interpretation);
+ ASSERT_EQUALS(SMT_MATCH, srgs_grammar_match(grammar, "7", &interpretation));
+ ASSERT_STRING_EQUALS("7", interpretation);
+ ASSERT_EQUALS(SMT_MATCH_END, srgs_grammar_match(grammar, "715", &interpretation));
+ ASSERT_STRING_EQUALS("4", interpretation);
ASSERT_EQUALS(SMT_NO_MATCH, srgs_grammar_match(grammar, "8", &interpretation));
ASSERT_NULL(interpretation);
ASSERT_EQUALS(SMT_MATCH_END, srgs_grammar_match(grammar, "9", &interpretation));