Created
July 24, 2013 16:42
-
-
Save doofusdavid/6072257 to your computer and use it in GitHub Desktop.
quick and dirty wordpress slug generator in excel for data import from an existing database.
This file contains hidden or 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(CLEAN(SUBSTITUTE(TRIM(C2)," ","-"))) |
It obviously depend on your slug algorithm. However in google spreadsheet you can use
=LOWER(SUBSTITUTE(REGEXREPLACE(REGEXREPLACE(TRIM(C2),"[^a-zA-Z0-9\s]",""),"\s{2,}"," ")," ","-"))
In Excel you will have to implement REGEXREPLACE as a macro (it should not be too difficult)
My gawd I need this - thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent! Thank you, but I did need to modify this script just a tad because I found that some of my product names had quotes in them ("). Here's how to remove those all in one script.
=LOWER(CLEAN(SUBSTITUTE(SUBSTITUTE(TRIM(C2)," ","-"),CHAR(34),"")))