docs: def validate_regexp(pattern, flags=0):
      """
      Validate the field matches the given regular expression.
      Should work with anything that supports '==' operator.
  
      :param pattern: Regular expresion to match. String or regular expression instance.
      :param pattern: Flags for the regular expression.
      :raises: ``ValidationError('equal')``
      """
      regex = re.compile(pattern, flags) if isinstance(pattern, str) else pattern
  
      def regexp_validator(field, data):
          if field.value is None:
              return
          if regex.match(str(field.value)) is None:
              raise ValidationError('regexp', pattern=pattern)
      return regexp_validator