#NEWLINE# def get_email_regex( self ) : #NEWLINE# #INDENT# '\n        Return a regex pattern matching valid email addresses. Uses the same\n        logic as the django validator, with the folowing exceptions:\n\n        - Internationalized domain names not supported\n        - IP addresses not supported\n        - Strips lookbehinds (not supported in javascript regular expressions)\n        ' #NEWLINE# validator = self . default_validators [ 0 ] #NEWLINE# user_regex = validator . user_regex . pattern . replace ( '\\Z' , '@' ) #NEWLINE# domain_patterns = ( [ ( re . escape ( domain ) + '$' ) for domain in validator . domain_whitelist ] + [ validator . domain_regex . pattern . replace ( '\\Z' , '$' ) ] ) #NEWLINE# domain_regex = '({0})' . format ( '|' . join ( domain_patterns ) ) #NEWLINE# email_regex = ( user_regex + domain_regex ) #NEWLINE# return re . sub ( '\\(\\?\\<[^()]*?\\)' , '' , email_regex )