Hi there!
I guess I am mediocre at programming - mostly on ANSI C and a bit object oriented.
Node-red is still fairly new to me.
For a Rest API call with multiple requests I am trying to modify the url to make the second request. In order to do so I need to modify values in the url-string and replace them with calculated values.
From an example I copied and modified the nodes and it works fine - appart from the url modification.
The JSONata code is:
$replace(
url,
/(limit=)(.+)(&offset=)(.+)/,
"$1" & "$2" & "$3" & $string( $number($4) + 50)
)
For the url-string:
"url": "https://mywebsite/?limit=50&offset=100"
I would expect a result like this:
https://mywebsite/?limit=50&offset=150
What I am getting is missing the correct offset value.
https://mywebsite/?limit=50&offset=
I checked $4 it does indeed contain the former offset value of 100. To me it seems I am getting the syntax somehow wrong to address the $4 properly. I tried a million different formats that I found online, to no avail.
Can someone point me in the right direction please?
Thanks a lot!!
Cheers