The purpose of this module is to provide easy ways to validate strings are in the correct format for use.
TODO
Validation class
import re
from dataclasses import dataclass
@dataclass
class Validator:
validation_string:str
def validate(self, value:str, as_bool:bool=False) -> :
compiled_expression = re.compile(self.validation_string)
if not as_bool:
return compiled_expression.match(value) # Return full match groups
else:
return bool(compiled_expression.match(value))
def __repr__(self) ->str:
return self.validation_string
Validation instances
The purpose of this module is to provide easy ways to validate strings are in the correct format for use.
TODO
__repr__(), validate()Validation class
Validation instances