RegularExpressionValidator constructor
A validator that checks if a value matches a specified regular expression.
This validator is used to validate values and returns an error message if the value does not match the specified regular expression.
Example usage:
final validator = RegularExpressionValidator('Invalid email address', r'^[a-zA-Z\d.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z\d-]+(?:\.[a-zA-Z\d-]+)*$');
String? result = validator.validate('john.doe@example');
print(result); // Output: 'Invalid email address'
Implementation
const RegularExpressionValidator(this.regExp, [super.errorMessage]);