def search_fields(self, string_or_compiled, field='', ignore_case=True):
		"""Return MatchObject if string_or_compiled found in entry else None.
		Find regular expression in entry.
		If field is omitted, search is through all fields.
		
		:note: used by BibFile's find_re method, which is used in turn by bibsearch.py
		:Parameters:
		  `string_or_compiled` : string to compile or compiled regex
		    pattern for searching
		  `field` : string
		    field to search in self (default: search all fields)
		"""
		if isinstance(string_or_compiled, str):
			if ignore_case:
				reo = re.compile(string_or_compiled, re.MULTILINE | re.IGNORECASE)
			else:
				reo = re.compile(string_or_compiled, re.MULTILINE)
		else: #must have a compiled regular expression
			reo = string_or_compiled
		if not field: #->try all fields (but not citekey)
			for f in self.get_fields():
				found = reo.search( self[f] )
				if found: break # no need to check more fields
		#:note: CAN test 'field in self' (even though an entry will not raise KeyError! see TODO above)
		#       BUT do not test 'field in self' bc want test for empty fields below
		elif self[field]:
			found = reo.search( self[field] )
		else:
			if field in self:
				bibfile_logger.info((self,field)%"Empty field %s in entry\n%s.\n.")
			found = None
		return found
dataset/ETHPy150Open matthew-brett/bibstuff/bibstuff/bibfile.py/BibEntry.search_fields/swapped operands of `%`