pattern static method
Fails when a non-empty value doesn't match regex.
Implementation
static FormFieldValidator<String> pattern(
RegExp regex, [
String message = 'Invalid format',
]) =>
(value) => (value == null || value.isEmpty || regex.hasMatch(value))
? null
: message;