Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Diacritics transformation for an URL

Topic Labels: Formulas
1042 1
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')