code: def match_regex(pattern: str, message=None, *, flags=0,
                  fullmatch: bool = False) -> Filter_T:
      
  
      pattern = re.compile(pattern, flags)
  
      def validate(value):
          if fullmatch:
              if not re.fullmatch(pattern, value):
                  _raise_failure(message)
          else:
              if not re.match(pattern, value):
                  _raise_failure(message)
          return value
  
      return validate
docs: Validate any string object to ensure it matches a given pattern.