How to Slugify a String in PHP
Here is a snippet for generating a URL friendly slug in PHP
return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string), '-'));
And you can use it in your code like so
How to Create a Slug in Python with the Re Module
There are a few 3rd party modules that do this sort of thing. But there is a pretty solution using out of the box Python functionality. You don't have to install any dependencies if you use the `re` module.
text = ' asdfladf ljklasfj 2324...