Skip to content

Commit

Permalink
add is_valid_email
Browse files Browse the repository at this point in the history
  • Loading branch information
xyluo25 committed Mar 11, 2024
1 parent 41e68ad commit 3159097
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyufunc/util_office/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
# Author/Copyright: Mr. Xiangyong Luo
##############################################################

from ._email import is_valid_email

__all__ = []
__all__ = ["is_valid_email"]
29 changes: 29 additions & 0 deletions pyufunc/util_office/_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding:utf-8 -*-
##############################################################
# Created Date: Monday, March 11th 2024
# Contact Info: [email protected]
# Author/Copyright: Mr. Xiangyong Luo
##############################################################

import re


def is_valid_email(email: str) -> bool:
"""check if the email is valid
Args:
email (str): email address, eg. [email protected]
Returns:
bool: True if the email is valid, False otherwise
Examples:
>>> from pyufunc import is_valid_email
>>> is_valid_email("[email protected]")
True
>>> is_valid_email("luoxiangyong01")
False
"""

return bool(re.match(r"[^@]+@[^@]+\.[^@]+", email))
1 change: 1 addition & 0 deletions utility_function_package_review.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Updating...
| | | | |

psutil
gputil
pyhelpers
pyutilator - @print_return_value @print_kwargs @print_args
pyutil 3.3.6
Expand Down

0 comments on commit 3159097

Please sign in to comment.