def matchline(allregex, line):
    """ Apply regexes to line

    Parameters
    ----------
    allregex : List[(regex, patinfo)]
        a list of tuples
    line : Line to be matched

    Returns
    -------
    tuple :   (ip, matching pattern)
        if a match is found
    None  : None if no match
    """

    for reg, pattern in allregex:
        ma = reg.search(line)
        if ma:
            return (ma.group(1), pattern)
    return None