OL Learn

Replace All in Designer

Hi trying to replace text within a variable using below code

var Test=GraphicName.replace("%20", " ");

However it is only replacing the first instance, if I use below

var Test=GraphicName.replace("%20", " “).replace(”%20", " ");

It replaces the first and second instance… is there a replaceall function at all? tried this and doesn’t work though I have seen examples… not sure if I’m getting the syntax wrong.



Hi Ol,

Try replacing using regex instead.

var Test=GraphicName.replace(/%20/g, " ");


Great thanks works!! :slight_smile: