Skip to main content

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?

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

 


Reply