def match_command_to_alias(command, aliases, match_multiple=False):
    """
    Match the text against an action and return the action reference.
    """
    results = []

    for alias in aliases:
        formats = list_format_strings_from_aliases([alias], match_multiple)
        for format_ in formats:
            try:
                extract_parameters(
                    format_str=format_["representation"], param_stream=command
                )
            except ParseException:
                continue

            results.append(format_)
    return results

    Match the text against an action and return the action reference.
    
st2common/st2common/util/actionalias_matching.py