docs: def filterMapNames(regexText,  records=getIndex(), excludeRegex=False, closestMatch=True):
      """matches each record against regexText according to parameters
      NOTE: the code could be written more simply, but this is loop-optimized to
            scale better with a large number of map records"""
      bestScr = 99999 # a big enough number to not be a valid file system path
      regex = re.compile(regexText, flags=re.IGNORECASE)
      ret = []
      if excludeRegex: # match only records that do NOT contain regex
          if regexText and closestMatch: # then maps with fewer characters are better matches
              for m in list(records):
                  if re.search(regex, m.name): continue # map must NOT contain specified phrase
                  score = len(m.name) # the map with the smallest map name means it has the largets matching character percentage
                  if score == bestScr:
                      bestScr = score
                      ret.append(m)
                  elif score <  bestScr: # new set of best maps
                      bestScr = score
                      ret = [m]
          else: # all maps that match regex are included
              for m in list(records):
                  if re.search(regex, m.name): continue # map must NOT contain specified phrase
                  ret.append(m) # any mapname containing regex matches
      else: # only match records that contain regex
          if regexText and closestMatch: # then maps with fewer characters are better matches
              for m in records:
                  if not re.search(regex, m.name): continue # map must contain specified phrase if excludeRegex==True
                  score = len(m.name) # the map with the smallest map name means it has the largets matching character percentage
                  if score == bestScr:
                      bestScr = score
                      ret.append(m)
                  elif score <  bestScr: # new group of best maps
                      bestScr = score
                      ret = [m]
          else: # all maps that match regex are included
              for m in records:
                  if not re.search(regex, m.name): continue # map must contain specified phrase if excludeRegex==True
                  ret.append(m) # any mapname containing regex matches
      return ret