Created
April 13, 2016 10:10
-
-
Save javifr/08ee7fd571d4e58c741e644ad8167489 to your computer and use it in GitHub Desktop.
Regexp to slugify a string field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select XXXX , regexp_replace( | |
translate( | |
replace(lower(replace(lower(replace(lower(replace(lower(replace(lower(replace(lower(YOURFIELDNAME), 'ñ', 'n')), 'º', 'o')), 'ª', 'a')), 'ç', 'c')), '-', '_')), ' ', '_'), 'áàâãäåāăąÁÂÃÄÅĀĂĄèééêëēĕėęěĒĔĖĘĚìíîïìĩīĭÌÍÎÏÌĨĪĬóòôõöōŏőÒÓÔÕÖŌŎŐùúûüũūŭůÙÚÛÜŨŪŬŮ','aaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiooooooooooooooouuuuuuuuuuuuuuuu' | |
), '[^\w -]', '', 'g') | |
from YYYYY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment