Hello,

at least one problem is the next line in your code:

subst->len = sizeof(pattern);

should be:

subst->len = strlen(pattern);

Because patter is declared as 'char*', sizeof returns 4 or 8 (if 32b or 64b architecture).

Try with that change and see how far it goes.

Cheers,
Daniel

On 11/03/15 00:43, Cockhootec Yahrabee wrote:
Hi guys,
I am trying to 'search&replace' some patterns in message body but unfortunately with no result (but bunch of errors).

First of all I am trying to perform regex substitution as one that can be seen at https://regex101.com/r/vF1kZ7/1

Since I have regular expression I am trying to convert it so it will work with `sub_str` function from re.h

Here is my attempt: https://gist.github.com/ivanbarlog/1b552b57e89bf4670872#file-test-c-L12

I had quite lot of errors but last error I am getting is that `subst_parser` cannot find separator https://github.com/kamailio/kamailio/blob/master/re.c#L240

Since the `struct subst_expr` is not parsed right the next error is segfault in `subst_str` function.



If someone can explain me how exactly I should use `subst_str` function with my regex I'll be really grateful. Little example code would be also great.

Thanks in advance


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com