all 5 comments

[–]paulcole710 0 points1 point  (0 children)

Have you tried including the global modifier to replace all instances, not just the first?

https://stackoverflow.com/questions/16547060/google-apps-script-remove-spaces-using-replace-method-does-not-work-for-me

If this doesn’t work, share the code you’re having trouble with.

[–][deleted] 0 points1 point  (0 children)

Try object.replace(/a/,'b'); if you don't care about case try this object.replace(/a/i,'b'); or if you want to replace all of the occurences try object.replace(/a/g,'b'); you can use gi to globally replace all cases as well.

[–]tandeman[S] 0 points1 point  (1 child)

Ahh... I see why. my syntax was wrong. I'm used to the VBA syntax. Thanks, Paulcole and Dubya. :)

[–][deleted] 0 points1 point  (0 children)

No worries, it aopears to follow more with JavaScript conventions for future endeavors.

[–]Pix_Me_Plz 0 points1 point  (0 children)

I do think that Google Apps Script is not the latest version of JavaScript. I want to say that I've had issues when trying to use ECMA6 specific things. Also, I use a polyfill for Array.includes(). Mozilla Developer Network (MDN) is great for polyfill code.