matches static method
Checks if checkValue can be matched by the regular expression pattern
If checkValue is null or is not matched by the RegEx pattern the
errorMessage will be returned if provided, otherwise the default error.
Otherwise null is returned
Implementation
static String? matches(String? checkValue, String pattern,
{String? errorMessage}) {
return ((checkValue == null) || !RegExp(pattern).hasMatch(checkValue))
? (errorMessage ?? "Field fails validation")
: null;
}