Files
a-dog-a-pet/app/utils/validators/validators.py

12 lines
321 B
Python

import re
from typing import Optional
class Validators:
@staticmethod
def is_valid_str_and_pattern(string: Optional[str], pattern: str):
if(isinstance(string, str)):
regex = re.compile(pattern)
if(regex.match(string) is not None):
return True
return False