Skip to content

Forward slash is valid url character but removed #98

@kmturley

Description

@kmturley

Slugify is designed to support valid url characters. However if I pass in a forward slash:

slugify(`Something/Another thing`, { lower: true })

The result is:

somethinganother-thing

Where I would expect:

something/another-thing

This can of course be mitigated by changing the remove RegEx adding \/:

console.log(slugify(`Something/Another thing`, { lower: true, remove: /[^\w\s$*_+~.()'"!\-:@\/]+/g }));

But this is not a very elegant solution. Ideally there would be an ignore/exclude character feature?

console.log(slugify(`Something/Another thing`, { lower: true, exclude: '/' }));

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions