'Initialized regex validator.
Args:
regex: Regular expression string to use for comparison.
Raises:
AttributeDefinitionError: if string_type is not a kind of string.'

def __init__(self, regex, string_type=unicode, default=None):

    super(Regex, self).__init__(default)
    if ((not issubclass(string_type, basestring)) or (string_type is basestring)):
        raise AttributeDefinitionError(('Regex    fields    must    be    a    string    type    not    %s.' % str(string_type)))
    if isinstance(regex, basestring):
        self.re = re.compile(('^(?:%s)$' % regex))
    else:
        raise AttributeDefinitionError(('Regular    expression    must    be    string.        Found    %s.' % str(regex)))
    self.expected_type = string_type
