code: def search_file(pattern, file_path):
      
      try:
          with open(file_path) as file:
              string = file.read()
      except PermissionError:
          return []
  
      matches = re.findall(pattern, string)
  
      return matches
docs: Search a given file's contents for the regex pattern given as 'pattern'