Pattern Rules
Password
Validate that a string is a valid password based on various criteria.
Parameters:
- uppercase (bool, optional): Whether the password must contain uppercase letters (default: True).
- lowercase (bool, optional): Whether the password must contain lowercase letters (default: True).
- numbers (bool, optional): Whether the password must contain numeric digits (default: True).
- symbols (bool, optional): Whether the password must contain symbols (default: True).
- length (int, optional): The minimum length of the password (default: 8).
- messages (dict[str,str],optional): custom error message
message has this default value
{
"base_message": "{field_name} field must include at least {messages}",
"uppercase": "one uppercase letter",
"lowercase": "one lowercase letter",
"numbers": "one digit",
"symbols": "one symbol",
"length": "be at least {length} characters",
}
Example
this is simple example of how to use Password validator
Validate that a string value is a valid email address.
Parameters:
- message (str,optional): The error message to be used if the validation fails.
MatchRegex
Validator to check if a value matches a specified regular expression pattern.
Parameters:
- pattern (str): The regular expression pattern to check against. (required)
- message (str,optional): The error message to be used if the validation fails.
Example
NotMatchRegex
Validator to check if a value does not match a specified regular expression pattern.
Parameters:
- pattern (str): The regular expression pattern to check against. (required)
- message (str,optional): The error message to be used if the validation fails.