- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 07, 2023 10:56 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 13, 2023 11:17 AM
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')