import re


def get_reference_id(reference):
    """
    Extract reference id ([N])
    :param reference: Any possible reference
    :return: reference id
    """
    ref_id = -1
    match = re.search('\[[0-9]+\]', reference)
    if match:
        ref_id = int(match.group(0).strip('[]'))
    return ref_id