fromRegex static method
Creates a validator from a regular expression
Implementation
static Validator<String> fromRegex(RegExp regex, {required dynamic error}) {
return Verify.empty<String>().flatMap((String input) {
return regex.hasMatch(input)
? Verify.valid(input)
: Verify.error<String>(error);
});
}