Layer7 API Management

Expand all | Collapse all

substring function

Jump to Best Answer
  • 1.  substring function

    Posted 06-14-2017 08:03 AM



    Is there any assertion for creating substrings with variable length of a given context variable in the api gateway? 

    --> substring(beginIndex, endIndex)


    My guess was doing this with regex with the following pattern: 


    This matches only the first 100 characters and it works, but we need the character amount to be set dinamically:


    Here we could set the context variable maxLength to 100 or whatever.

    But this never matches to any given string because the regular expression assertion treats the input from the context variable maxLength as literals e.g. 


  • 2.  Re: substring function
    Best Answer

    Posted 06-14-2017 11:14 AM

    Found it out by myself. I can use the xpath function substring($string, $start, $end)

  • 3.  Re: substring function

    Posted 10-24-2018 08:19 AM

    Could you please help me with which assertion we have to use to configure substring(......)

  • 4.  Re: substring function

    Posted 10-24-2018 09:00 AM



    I created an encapsulated assertion with the assertion "Response must match Xpath" like this:

  • 5.  RE: Re: substring function

    Posted 06-17-2020 12:06 PM
    When I have already created what you indicate, how can I call them within my API GW project?
    How can I put the string parameters and the start and end positions?

    Applications Architect