[OpenSIPS-Devel] [OpenSIPS/opensips] db0588: Flexible s.substr transformation

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Oct 17 04:52:55 EDT 2018


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: db0588c157448db5e9cd90e27b5f2548f5169e3a
      https://github.com/OpenSIPS/opensips/commit/db0588c157448db5e9cd90e27b5f2548f5169e3a
  Author: Nick Altmann <nick.altmann at gmail.com>
  Date:   2018-10-15 (Mon, 15 Oct 2018)

  Changed paths:
    M transformations.c

  Log Message:
  -----------
  Flexible s.substr transformation

{s.substr,offset,length}

Return substring starting at offset having size of 'length'.
If offset is negative, then it is counted from the end of the value, -1 being the last char.
In case of positive value, 0 is first char.

Length can be positive or negative.
In case length is negative, it is counted from the end of the value, 0 means last character.

Example:
$var(x) = "abcdefghijk";

$(var(x){s.substr,3,4}) = "defg"
$(var(x){s.substr,1,0}) = "bcdefghijk"
$(var(x){s.substr,2,-2}) = "cdbcdefghi"
$(var(x){s.substr,-5,-3}) = "gh"
$(var(x){s.substr,-5,0}) = "ghijk"
$(var(x){s.substr,-100,0}) = "abcdefghijk"
$(var(x){s.substr,2,100}) = "cdefghijk"
$(var(x){s.substr,100,5}) = ""


  Commit: 6b37dab8b831bf1f0056d2f90c40a5172d5ce751
      https://github.com/OpenSIPS/opensips/commit/6b37dab8b831bf1f0056d2f90c40a5172d5ce751
  Author: Bogdan-Andrei Iancu <bogdan at opensips.org>
  Date:   2018-10-17 (Wed, 17 Oct 2018)

  Changed paths:
    M transformations.c

  Log Message:
  -----------
  Merge branch 'flexible-subst' of https://github.com/nikbyte/opensips into nikbyte-flexible-subst


  Commit: d776fde26ee8f90a2135ffcf3a953a7629b63c64
      https://github.com/OpenSIPS/opensips/commit/d776fde26ee8f90a2135ffcf3a953a7629b63c64
  Author: Bogdan-Andrei Iancu <bogdan at opensips.org>
  Date:   2018-10-17 (Wed, 17 Oct 2018)

  Changed paths:
    M transformations.c

  Log Message:
  -----------
  Fixes and tuning for the substr patch

Do not allow negative offset underflow - this was the original behavior
Tune checks and ops to translate negative indexes and offsets.


  Commit: bbb8c97d8f35e29e62b92f8035ccede0fcbba8a3
      https://github.com/OpenSIPS/opensips/commit/bbb8c97d8f35e29e62b92f8035ccede0fcbba8a3
  Author: Bogdan-Andrei Iancu <bogdan at opensips.org>
  Date:   2018-10-17 (Wed, 17 Oct 2018)

  Changed paths:
    M transformations.c

  Log Message:
  -----------
  Merge branch 'nikbyte-flexible-subst'


Compare: https://github.com/OpenSIPS/opensips/compare/3f04700e329f...bbb8c97d8f35
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the Devel mailing list