import re


def get_tab_info(root):
    """
    Returns the prefix, separator, and max index for a set of jQueryUI tabs
    """
    hrefs = [y.attrib['href'] for y in
                [x.find('a') for x in root.find('ul').findall('li')]
            ]
    splits = [r.groups() for r in
                [re.match('#(.*)([-_]+)(\d+)$', h) for h in hrefs]
              if r]
    names   = {s[0] for s in splits}
    seps    = {s[1] for s in splits}
    indices = [s[2] for s in splits]

    if len(names) > 1:
        raise ValueError("Tab names lack a common prefix")
    elif len(names) == 0:
        raise ValueError("Tab names seem to be missing")

    return names.pop(), seps.pop(), max(indices)