creditCardExpirationDate static method
FormFieldValidator that requires the field's value to be a valid credit card expiration date.
Parameters:
checkForExpirationWhether the expiration date should be checkedregexThe regex pattern to match.errorTextThe error message when the expiration date is invalid.checkNullOrEmptyWhether to check for null or empty values.
This regex matches credit card expiration dates.
- It checks for a valid month (01-12).
- It checks for a valid year (two digits).
Examples: 01/23, 12/25
Implementation
static FormFieldValidator<String> creditCardExpirationDate({
bool checkForExpiration = true,
RegExp? regex,
String? errorText,
bool checkNullOrEmpty = true,
}) => CreditCardExpirationDateValidator(
checkForExpiration: checkForExpiration,
regex: regex,
errorText: errorText,
checkNullOrEmpty: checkNullOrEmpty,
).validate;