Skip to content

Instantly share code, notes, and snippets.

@akhilrs
Forked from doofusdavid/gist:6072257
Created January 19, 2017 11:42
Show Gist options
  • Save akhilrs/8e6eb55b33347267865f9cb3a1552808 to your computer and use it in GitHub Desktop.
Save akhilrs/8e6eb55b33347267865f9cb3a1552808 to your computer and use it in GitHub Desktop.
quick and dirty wordpress slug generator in excel for data import from an existing database.
=LOWER(CLEAN(SUBSTITUTE(TRIM(C2)," ","-")))
@akhilrs
Copy link
Author

akhilrs commented Jan 19, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment