Last active
November 19, 2021 20:42
-
-
Save Bronskiy/e3d8c9fe72512e5ff77bae7c43ddaa08 to your computer and use it in GitHub Desktop.
MySQL to convert a string into a slug
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
LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM('My String'), ':', ''), ')', ''), '(', ''), ',', ''), '%', '') , '@', ''), '#', ''), '=', '-'), '^', ''), '+', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) AS `post_name` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment