Skip to main content
Question

Jinja Templates to isolate a token

  • June 2, 2023
  • 0 replies
  • 297 views

Forum|alt.badge.img+3

Hi:

I am trying to build webhook pipline where I need to supply a token that is returned from the request.  The token is embedded in a long text string separated with delimiters.  When I go to use this token, I am able to use a split jinja template to get at the "front" part of the token. 

{{b.content.split(':"')[1]}}

However, there is another irrelevant text string after the token separated with a ','   Can somone suggest how I nest my jinja templates to do this and do I do another "split" or???

Please and thank you!

Melissa 



------------------------------
Melissa Freel
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+11

An example of the string will help

{{ b.content.split(':"')[1].split(',')[0] }}


Based on gut feel , you want to split the string twice, once with : and then with , . 
Above is based on scenario , these two delimiters would always be present otherwise this will throw an error. 



------------------------------
Prashant Maheshwari
------------------------------