提交 10657f3f authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-4675 --resolve

上级 ff3c0139
...@@ -1563,15 +1563,19 @@ SWITCH_STANDARD_API(regex_function) ...@@ -1563,15 +1563,19 @@ SWITCH_STANDARD_API(regex_function)
proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0])); proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0]));
if (argc > 2) { if (argc > 2) {
len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed; if (proceed) {
substituted = malloc(len); len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed;
switch_assert(substituted); substituted = malloc(len);
memset(substituted, 0, len); switch_assert(substituted);
switch_replace_char(argv[2], '%', '$', SWITCH_FALSE); memset(substituted, 0, len);
switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector); switch_replace_char(argv[2], '%', '$', SWITCH_FALSE);
switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector);
stream->write_function(stream, "%s", substituted);
free(substituted); stream->write_function(stream, "%s", substituted);
free(substituted);
} else {
stream->write_function(stream, "%s", argv[0]);
}
} else { } else {
stream->write_function(stream, proceed ? "true" : "false"); stream->write_function(stream, proceed ? "true" : "false");
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论