diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/edify/library/__init__.py | 1 | ||||
| -rw-r--r-- | src/edify/library/guid.py | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/edify/library/__init__.py b/src/edify/library/__init__.py index d048a8c..fe1f116 100644 --- a/src/edify/library/__init__.py +++ b/src/edify/library/__init__.py @@ -11,3 +11,4 @@ from .phone import phone_number from .url import url from .uuid import uuid from .zip import zip +from .guid import guid diff --git a/src/edify/library/guid.py b/src/edify/library/guid.py new file mode 100644 index 0000000..a9fb45a --- /dev/null +++ b/src/edify/library/guid.py @@ -0,0 +1,14 @@ +import re + +pattern = "^(?:\\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\\}{0,1})$" + +def guid(guid: str) -> bool: + """Check if the given string is a valid GUID. + + Args: + guid (str): The string to check. + + Returns: + bool: True if the string is a valid GUID, False otherwise. + """ + return bool(re.match(pattern, guid)) |
