Skip to main content
Hi everyone,

I have a custom event that contains a property formatted like so:

`fullpath: /string-1/string-2/string-3/string-4`

I was wondering if there is a way to use Handlebars helpers to splice this string, and return the last substring ('string-4') in a template?

Thanks so much in advance for your help!
Hi Lily! Thanks for reaching out! Unfortunately there isn't a good handlebar that will do this on our end.

We do have the substring handlebar helper: https://support.iterable.com/hc/en-us/articles/205480365-Personalizing-Templates-with-Handlebars-#get-substring-by-index-substring, but this only works if you know the index of string-4, but I suspect this field may have varying length strings so this likely won't help in this case.

We don't currently have a means to separate a string by a character like "/" and only pull the last substring based on that separation, which is how I'd go about doing this.

In general, it'd be best if you could parse out string-4 into a new field on your end so it can be returned in a template!

Reply