<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    at least one problem is the next line in your code:<br>
    <br>
    subst->len = sizeof(pattern);<br>
    <br>
    should be:<br>
    <br>
    subst->len = strlen(pattern);<br>
    <br>
    Because patter is declared as 'char*', sizeof returns 4 or 8 (if 32b
    or 64b architecture).<br>
    <br>
    Try with that change and see how far it goes.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 11/03/15 00:43, Cockhootec Yahrabee
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJetf70HhJgHMFjqSrSQGNwrnSqCPjNBa31+ivV9CwnZ1WuXMg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi guys,
        <div>I am trying to 'search&replace' some patterns in
          message body but unfortunately with no result (but bunch of
          errors).</div>
        <div><br>
        </div>
        <div>First of all I am trying to perform regex substitution as
          one that can be seen at <a moz-do-not-send="true"
            href="https://regex101.com/r/vF1kZ7/1">https://regex101.com/r/vF1kZ7/1</a></div>
        <div><br>
        </div>
        <div>Since I have regular expression I am trying to convert it
          so it will work with `sub_str` function from re.h</div>
        <div><br>
        </div>
        <div>Here is my attempt: <a moz-do-not-send="true"
href="https://gist.github.com/ivanbarlog/1b552b57e89bf4670872#file-test-c-L12">https://gist.github.com/ivanbarlog/1b552b57e89bf4670872#file-test-c-L12</a></div>
        <div><br>
        </div>
        <div>I had quite lot of errors but last error I am getting is
          that `subst_parser` cannot find separator <a
            moz-do-not-send="true"
            href="https://github.com/kamailio/kamailio/blob/master/re.c#L240">https://github.com/kamailio/kamailio/blob/master/re.c#L240</a></div>
        <div><br>
        </div>
        <div>Since the `struct subst_expr` is not parsed right the next
          error is segfault in `subst_str` function.</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>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.</div>
        <div><br>
        </div>
        <div>Thanks in advance</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>