htmlTagValidator static method

String? htmlTagValidator(
  1. String? value, [
  2. String? errorMessage
])

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;
}