sanic/guide/webapp/display/text.py
2023-10-25 03:02:26 +01:00

9 lines
159 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(" ", "-"))