def get_email_regex(self):
validator = self.default_validators[<NUM_LIT:0>]<EOL>user_regex = validator.user_regex.pattern.replace('<STR_LIT>', '<STR_LIT:@>')<EOL>domain_patterns = ([re.escape(domain) + '<STR_LIT:$>' for domain in<EOL>validator.domain_whitelist] +<EOL>[validator.domain_regex.pattern.replace('<STR_LIT>', '<STR_LIT:$>')])<EOL>domain_regex = '<STR_LIT>'.format('<STR_LIT:|>'.join(domain_patterns))<EOL>email_regex = user_regex + domain_regex<EOL>return re.sub(r'<STR_LIT>', '<STR_LIT>', email_regex)<EOL>
Return a regex pattern matching valid email addresses. Uses the same
logic as the django validator, with the folowing exceptions:

- Internationalized domain names not supported
- IP addresses not supported
- Strips lookbehinds (not supported in javascript regular expressions)