mustHaveLowercase method
Adds a validation rule that checks if the String? contains at least one lowercase letter.
message is the error message returned if the validation fails. Defaults to "Must contain at least one lowercase letter".
code is an optional error code for translation purposes.
Returns the LucidValidationBuilder to allow for method chaining.
Example:
...
ruleFor((user) => user.password, key: 'password') // user.password is nullable
.mustHaveLowercase();
String format args:
- {PropertyName}: The name of the property.
'{PropertyName}' must have at least one lowercase letter.
Implementation
SimpleValidationBuilder<String?> mustHaveLowercase(
{String? message, String? code}) {
return useValidation(
(value, entity) => value != null && RegExp(r'[a-z]').hasMatch(value),
code: code ?? Language.code.mustHaveLowercase,
message: message,
);
}