0

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, "")
isherwood
  • 58,414
  • 16
  • 114
  • 157
Santiago
  • 1
  • 1
  • Please see [ask], then revise your post title to ask a clear, specific question in sentence format. Don't add tags. Also use the tools available to you in the editor to format your code properly. – isherwood Jun 09 '23 at 19:58
  • https://stackoverflow.com/questions/69031822/remove-diacritics-from-string-in-snowflake – Greg Pavlik Jun 09 '23 at 20:43

0 Answers0