def _parseTagName(tag, offset):
    """
    parse the packet to get the base tag name
    the offset is so that we can increment the array pointer if need be
    """
    bt = tag
    ind = 0
    try:
        if tag.endswith(']'):
            pos = len(tag) - tag.rindex('[')
            bt = tag[:-pos]
            temp = tag[-pos:]
            ind = temp[1:-1]
            s = ind.split(',')
            if len(s) == 1:
                ind = int(ind)
                newTagName = bt + '[' + str(ind + offset) + ']'
            else:
                ind = []
                for i in range(len(s)):
                    s[i] = int(s[i])
                    ind.append(s[i])
        else:
            pass
        return tag, bt, ind
    except Exception:
        return tag, bt, 0
