sanic/guide/webapp/display/text.py

8 lines
158 B
Python
Raw Permalink Normal View History

import re
SLUGIFY_PATTERN = re.compile(r"[^a-zA-Z0-9-]")
def slugify(text: str) -> str:
return SLUGIFY_PATTERN.sub("", text.lower().replace(" ", "-"))