[Freeswitch-dev] About switch_regex_match_partial

Eduardo Nunes Pereira eduardonunesp at gmail.com
Thu Sep 23 10:22:49 PDT 2010


Hello people,

I have a doubt about the function implementation switch_regex_match_partial,
and used that function in my code to do a search of possible expressions
that can have a complete
match, so with each number obtained reach a complete match.

The strange thing is that when looking for an expression that is "$ 12 .^*",
return on
switch_regex_partial is SWITCH_STATUS_FALSE. I think there should be
partial, because there is possibility for a match.

Looking at the function code, I implemented the simple patch, as follows:

index 88152f9..38c527c 100644
--- a/src/switch_regex.c
+++ b/src/switch_regex.c
@@ -215,7 +215,7 @@ SWITCH_DECLARE(switch_status_t)
switch_regex_match_partial(const char *target, c
        if (match_count > 0) {
                *partial = 0;
                return SWITCH_STATUS_SUCCESS;
-       } else if (match_count == PCRE_ERROR_PARTIAL) {
+       } else if (match_count == PCRE_ERROR_PARTIAL || match_count ==
PCRE_ERROR_BADPARTIAL) {
                /* yes it is already set, but the code is clearer this way
*/
                *partial = 1;
                return SWITCH_STATUS_SUCCESS;


Thus a ERROR_PARTIAL and BAD_PARTIAL are regarded as PARTIAL.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20100923/94d3642d/attachment.html 


More information about the FreeSWITCH-dev mailing list