import re


def _order_from_regexp(items, order_regexps):
    """Re-order list given regular expression listed by priorities

    Example:
    --------
    >>> _order_from_regexp(["aA", "aZ", "bb", "bY", "cZ", "aY"], [".*Y", ".*Z"])
    ['bY', 'aY', 'aZ', 'cZ', 'aA', 'bb']
    """
    ordered = list()
    for order_regexp in order_regexps:
        matched = [item for item in items if re.search(order_regexp, item)]
        for item in matched:
            ordered.append(item)
            items.remove(item)
    ordered += items
    return ordered