AnsweredAssumed Answered

substring function

Question asked by res13 on Jun 14, 2017
Latest reply on Jun 14, 2017 by res13

Hi,

 

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: 

^.{0,100}

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

^.{0,${maxLength}}

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. 

^.{0,\1\0\0}

Outcomes