isRegex method
Checks if the object matches a regular expression
Implementation
AbstractRuleBuilder isRegex(String pattern, {String? message}) {
return must(
(dynamic dyn) => dyn is String && RegExp(pattern).hasMatch(dyn),
message != null
? message
: useKeyAsElementName
? '$key must match regular expression $pattern'
: "String must match regular expression $pattern",
code: "notRegex");
}