[SR-Users] kamailio re.subst question.

Daniel Tryba d.tryba at pocos.nl
Thu Mar 2 15:29:54 CET 2017

On Wed, Mar 01, 2017 at 04:58:00PM +0000, José Seabra wrote:
> #015#012Calling-Name-Status: available#015#012Calling-Name: "josé" <
> sip:5555555552 at>#015#012Presentation-Indicator: allowed#015#012
> The Kamailio re.subst function is constructed as the following:
> $sht(cnam=>$ci::calling_name)=$(var(rb){re.subst,/(.*)Calling-Name:
> ?([\W|0-9A-Za-z_]{5,500} ?[<>:@.|0-9A-Za-z_]{5,500})(.*)$/\2/s});
> The issue here is that this re.subst function doesn't match the accents, I
> have tested this regex on regex101.com and it does match. My question is
> how i can get the same result with re.subst?
> Anyone can help?

Maybe regexo101.com is wrong? \W is ^\w, \w contains [A-Za-z0-9_] but
depending on the lib might include much more like latin or UTF8. So if é
matches \w in kamailio but obviuosly never matches [A-Za-z0-9_], the é
doesn't match \W and thus "josé" doesn't match the minimum 5 chars.

[\W|\w]{5,500} would match, but that looks the same as .{5,500}

Never looked whether kamailio supports it but there is something that
matches non ascii word characters in regexp libs:

More information about the sr-users mailing list