Regex for URL slugs
Example pattern below—edit it or paste your own. All processing runs in your browser. For Python’s re module, switch flavor in the tool.
Flavor
Standard `RegExp` for explanation and preview.
g i m s u y d v (JavaScript)
Paths: /blog/my-first-post and tag/seo-tools-2025
Plain-English explanation
Flavor: JavaScript RegExp
Flags: g (find all matches)
a word boundary Then Match one character from: characters from the character "a" to the character "z", characters from the character "0" to the character "9", repeated one or more times. Then Match (non-capturing): Match the character "-". Then Match one character from: characters from the character "a" to the character "z", characters from the character "0" to the character "9", repeated one or more times, repeated zero or more times. Then a word boundary