htmlTagValidator static method
htmlTagValidator to validate HTML tag
validator: (value) => SimpleValidations.htmlTagValidator(value, [errorMessage]),
Implementation
static String? htmlTagValidator(String? value, [String? errorMessage]) {
RegExp regex = CustomRegEx.htmlTagRegex;
if (value == null || value.isEmpty) {
return errorMessage ?? 'Required';
} else if (!regex.hasMatch(value)) {
return errorMessage ?? 'Please enter valid HTML tags';
}
return null;
}