Insert a hyphen before the last 5 characters (aka the time)

I am setting a variable to get the Cloudinary id from an URL and need help inserting a hyphen.

Here is part of my original url
Weather%20screenshots/Weather-town%2036h-2023-11-24%2016:56.png

the end result should be this:
Weather-town 36h-2023-11-24-16:56

Right now I have this:

{{replace(replace(replace(last(split(9.`2`; "/")); "%20"; emptystring); ".png"; emptystring); replace(9.`1`; space; emptystring); 9.`1`)}}

the end result is this:
Weather-town 36h-2023-11-2416:56

so close!
I need somehow to insert a hyphen like this:
Weather-town 36h-2023-11-24-16:56

The hyphen is always before the time or the 5th character to the right of the string. Any ideas?

Check it out

blueprint.json (7.7 KB)


2.`new-clean` = {{last(split(first(split(decodeURL(1.original); ".")); "/"))}}

{{join(remove(split(2.`new-clean`; space); last(split(2.`new-clean`; space))); space)}}-{{last(split(2.`new-clean`; space))}}

3 Likes

Perfect, that worked. Thank you!

3 Likes