Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Diacritics transformation for an URL

701 0
cancel
Showing results for 
Search instead for 
Did you mean: 
filip
4 - Data Explorer
4 - Data Explorer

Hi guys!

I'm trying to convert a string into a slug, and I need to replace polish diacritics with standard Latin characters. Should I use the regex_replace() formula? If yes, which expression should I pick in this case?

1 Reply 1
Taylor_Johnston
6 - Interface Innovator
6 - Interface Innovator

Hi! 😊
I'm sure you've likely found a solution that works for you by now - but I just created a formula for this in my own base & thought I'd share just in case anyone else comes across this post searching for an example. 
Below are the diacritic characters I needed, but if you need more you can find a full list of characters here.

 

 

REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE({{your_field}}, '[àÀáÁâÂãÃäÄåÅæÆ]', 'a'), '[èÈéÉêÊëË]', 'e'), '[ìÌíÍîÎïÏ]', 'i'), '[ñÑ]', 'n'), '[øØœŒöÖõÕôÔóÓÒò]', 'o'), '[ùÙúÚûÛüÜ]', 'u'), '[ðÐ]', 'd'), '[çÇ]', 'c'), '[ÿŸýÝ]', 'y'), '[ß]', 's'), '[^A-Za-z0-9]+',"")

 

 

*please note, my formula also replaces special characters - if you don't need to do so, just replace the last expression or use this formula:

 

REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE(REGEX_REPLACE({{your_field}}, '[àÀáÁâÂãÃäÄåÅæÆ]', 'a'), '[èÈéÉêÊëË]', 'e'), '[ìÌíÍîÎïÏ]', 'i'), '[ñÑ]', 'n'), '[øØœŒöÖõÕôÔóÓÒò]', 'o'), '[ùÙúÚûÛüÜ]', 'u'), '[ðÐ]', 'd'), '[çÇ]', 'c'), '[ÿŸýÝ]', 'y'), '[ß]', 's')