code: def ismatch(text, pattern):
      
  
      if hasattr(pattern, 'search'):
          return pattern.search(text) is not None
      else:
          return pattern in text if Config.options.case_sensitive \
              else pattern.lower() in text.lower()
docs: Test whether text contains string or matches regex.