refactor: outsources common validation methods

This commit is contained in:
2024-12-08 19:53:33 -03:00
parent 76ef384102
commit 609abb3362
3 changed files with 19 additions and 14 deletions

View File

@@ -0,0 +1,12 @@
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