Skip to content

Commit

Permalink
Add slug validation utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
fvergaracl committed Mar 7, 2024
1 parent 6147c22 commit 1fa8631
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/util/validate_slug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import re


def validate_slug(slug):
"""
Validates a slug.
:param slug: The slug to validate.
:type slug: str
:return: True if the slug is valid, False otherwise.
:rtype: bool
"""
return re.match(r'^[a-z0-9_-]{3,60}$', slug) is not None

0 comments on commit 1fa8631

Please sign in to comment.