Truncating display of a string

Hey all,

I’m looking for the best way to truncate the display of a string on my sitemap. The Sonos Current track item many times is very long and doesn’t fit in the space provided on the site map, so it overruns and is ugly. I wanted to try to use a regex transform to truncate this display to the first 10 chars.

I tried this but it just gives me a NULL

String SonosBed_CurrentTrack            "Now playing [REGEX(^.{0,10}):%s]"    {channel="sonos:PLAY1:RINCON_123456789:currenttrack"}

I’m not great with regex nor regex transformations, so likly some syntax is messed up here. Anyone have an idea how to best do this?

I think you’d better try a JavaScript transform

2 Likes