sanic/guide/webapp/display/text.py
2023-09-06 15:44:00 +03:00

8 lines
158 B
Python

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