class RandomString(object):

    def __init__(self, regex):
        self.possible_strings = list(invRegex.invert(regex))

def random_string(self):
    return random.choice(self.possible_strings)
Is there a lib to generate data according to a regexp? (Python or other)