import re


def _split_token(token, middles, endings):
    """Returns start, middle & end of token.
    If searching only for middles, pass the empty string '' in the endings list.
    (and vice versa if searching only for endings)
    """
    pattern = re.compile(r'([a-z]+)(%s)(%s)' % ('|'.join(middles), '|'.join(endings)), re.I)
    match = re.fullmatch(pattern, token)
    if match:
        start, middle, end = match.group(1, 2, 3)
        if len(start) > 1:
            return start, middle, end
    return None