When trying to use
replaceAll() function from a String object in Snowflake’s Javascipt UDF, it will fail with the below error message:
Based on the information on Wikipedia, the string function replaceAll() was released in June 2021, with 12th Edition – ECMAScript 2021.
To perform a replace all on a string, we can use the
replace() function using a regular expression with a “g” global flag. Example as below:
"Mr Blue has a blue house and a blue car".replace(/blue/g, "red");
Mr Blue has a red house and a red car“