[SR-Users] Case insensitive regexp in textops::search() function

Andrey Deykunov deykunov at gmail.com
Thu Feb 1 08:31:18 CET 2018


POSIX solution more preferable and works for me.
Thank you, Dmitri!

2018-02-01 1:28 GMT+03:00 Dmitri Savolainen <savolainen at erinaco.ru>:

> Hi, Andrey.
>
> for PCRE there is module http://kamailio.org/docs/
> modules/devel/modules/regex.html
> and this should works
>
> modparam("regex", "pcre_caseless", 1)
> ....
> if (pcre_match("$mb", " $shtitval(i1)")) {
> ....
> }
>
>
> also with POSIX
>  if  ($mb =~   $shtitval(i1) ){
> }
>
> 2018-01-31 14:42 GMT+03:00 Andrey Deykunov <deykunov at gmail.com>:
>
>> Hi,
>>
>> I have an htable containing some black list words (i.e. user IDs or phone
>> models). To find matches of the words in every message I use the following
>> script:
>>
>> sht_iterator_start("i1", "black_list");
>> while(sht_iterator_next("i1")) {
>>    if ( search($shtitval(i1)) ) {
>>       // do something
>>    }
>> }
>> sht_iterator_end("i1");
>>
>> How can I modify search($shtitval(i1)) to get case insensitive matching?
>>
>> The example below does not work:
>>
>> sht_iterator_start("i1", "black_list");
>> while(sht_iterator_next("i1")) {
>>    $var(re) = $shtitval(i1) + "/i";
>>    if ( search($var(re)) ) {
>>       // do something
>>    }
>> }
>> sht_iterator_end("i1");
>>
>> Other possible modifications of $var(re) aren't working too.
>>
>> Thanks,
>> Andrey
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
>
> --
> Savolainen Dmitri
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180201/3c7b51d9/attachment.html>


More information about the sr-users mailing list