import re


def get_length(s):
    """ Determine the length of the string from it's name which is
    prepended as: 
    "foobar%d" % N
    """
    x = re.search("[\d]+$", s)
    # there can be only one or no match here
    n = 0
    if x :
        n = int(x.group(0))
    return n