For a given URL I want to retrieve its slug using Javascript and a regular expression. I tried the following but it only matches h
and not This-is-the-slug-to-be-matched
.
var url = "http://www.domain.com/region/town/This-is-the-slug-to-be-matched;art6066,1184999";
var slug = url.match(/[a-z0-9-]/);