Popular recipes tagged "slugify"http://code.activestate.com/recipes/tags/slugify/2011-07-12T17:46:49-07:00ActiveState Code Recipesslugify: make a string usable in a URL or filename (JavaScript)
2011-07-12T17:46:49-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577787-slugify-make-a-string-usable-in-a-url-or-filename/
<p style="color: grey">
JavaScript
recipe 577787
by <a href="/recipes/users/4173505/">Trent Mick</a>
(<a href="/recipes/tags/filename/">filename</a>, <a href="/recipes/tags/nodejs/">nodejs</a>, <a href="/recipes/tags/slug/">slug</a>, <a href="/recipes/tags/slugify/">slugify</a>, <a href="/recipes/tags/url/">url</a>).
Revision 2.
</p>
<p>"Slugify" a string so it has only alphanumeric and hyphen characters. Useful for URLs and filenames. This is a JavaScript (node.js too) version of <a href="http://code.activestate.com/recipes/577257/">Recipe 577257</a>.</p>
<p>Note: It is missing the guarantee that only ascii characters are passed through. I don't know an NFKD equivalent in JavaScript-land.</p>
slugify: make a string usable in a URL or filename (Python)
2010-06-07T04:11:55-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577257-slugify-make-a-string-usable-in-a-url-or-filename/
<p style="color: grey">
Python
recipe 577257
by <a href="/recipes/users/4173505/">Trent Mick</a>
(<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/filename/">filename</a>, <a href="/recipes/tags/slug/">slug</a>, <a href="/recipes/tags/slugify/">slugify</a>, <a href="/recipes/tags/url/">url</a>).
Revision 2.
</p>
<p>"Slugify" a string so it is ascii, has only alphanumeric and hyphen characters. Useful for URLs and filenames. This is heavily based on the slugify in Django.</p>
<p>Note: presumes that you've <code>import re</code>d higher up in your module.</p>