I use the following command line in a JAVASCRIPT UDF function in SNOWFLAKE to remove accents from a text string.
const str = "Crème Brulée"
str.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
But when I try this command line it doesn't work. It's supposed to work with the new version of Javascript ({Diacritic})
const str = "Crème Brulée"
str.normalize("NFD").replace(/\p{Diacritic}/gu, "")
Error showing
SQL Error [100131] [P0000]: JavaScript compilation error: Uncaught SyntaxError: Invalid regular expression: /p{Diacritic}/:
What could cause the problem? to the snowflake JavaScript version that did not yet work with this new functionality?
I am trying with this command line which was taken from this SO question.
const str = "Crème Brulée"
str.normalize("NFD").replace(/\p{Diacritic}/gu, "")