def findSelectedFields(fieldSearchList, fieldNames):
    """ fieldSearchList is a list of fields, potentially with wild cards. fieldNames is the 
    real list of field names. Returns a list of all fields that match the SearchList.
    """
    prefixes = []
    exactMatches = []
    for f in fieldSearchList:
        if f.endswith("*"):
            prefixes.append(f.rstrip("*"))
        else:
            exactMatches.append(f)

    fieldsShown = []
    for f in fieldNames:
        if f in exactMatches:
            fieldsShown.append(f)
            continue

        for pf in prefixes:
            if f.startswith(pf):
                fieldsShown.append(f)
                break
    return fieldsShown