[SR-Users] Case insensitive regexp in textops::search() function
Dmitri Savolainen
savolainen at erinaco.ru
Wed Jan 31 23:28:28 CET 2018
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180201/84e95ad4/attachment.html>
More information about the sr-users
mailing list