[Freeswitch-dev] About switch_regex_match_partial

Anthony Minessale anthony.minessale at gmail.com
Thu Sep 23 10:32:40 PDT 2010


file it on jira and attach the patch in a .txt file and we can add it.


On Thu, Sep 23, 2010 at 12:22 PM, Eduardo Nunes Pereira
<eduardonunesp at gmail.com> wrote:
> 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.
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



More information about the FreeSWITCH-dev mailing list