def searchList(listOfTerms, query: str, filter='in'):
    """Search within a list"""
    matches = []
    for item in listOfTerms:
        if filter == 'in' and query in item:
            matches.append(item)
        elif filter == 'start' and item.startswith(query):
            matches.append(item)
        elif filter == 'end' and item.endswith(query):
            matches.append(item)
        elif filter == 'exact' and item == query:
            matches.append(item)

    return matches