Modifying text URL parameters before display by Dynamic Text?


#1

I have a URL parameter that I’m using in a Dynamic Text item. That’s working perfectly, but I’d like to do a small regexp edit on the string.

It has “tok1 tok2 tok3 tok4 tok5” and I only want to show the first 4 tokens.

I’m not steeped in JS but I’ve cobbled together the following. Can anyone help to get this over the goal line?

My two questions:

  1. Is the code below suitable for use as in the page script area?
  2. How do I actually access the variable that’s holding my “event_date” string

URL_PARAM_VARIABLE.replace("/(\w+)\s(\w+)/", $1 $2 $3 $4); //only keep 1st 4 tokens

Suggestions?