pipr.tools

slugify

Convert text to URL-safe slug

Aa Text

Try it

stdin0 chars
stdout0 chars

Example

Slugify a blog post title

Usage
$ echo "My Blog Post: A Great Title!" | slugify
View source
(input) =>
      input
        .toLowerCase()
        .trim()
        .replace(/[^\w\s-]/g, "")
        .replace(/[\s_]+/g, "-")
        .replace(/-+/g, "-")
        .replace(/^-|-$/g, "")

Suggested Pipelines

Related Tools