def _build_regex(self):
<EOL>url_patterns = resolver.reverse_dict.get(self._meta.named_view)<EOL>try:<EOL><INDENT>regex = url_patterns[<NUM_LIT:1>]<EOL><DEDENT>except TypeError:<EOL><INDENT>raise OEmbedException('<STR_LIT>' % self._meta.named_view)<EOL><DEDENT>cleaned_sites = self.get_cleaned_sites()<EOL>site_regexes = []<EOL>for site in self.get_sites():<EOL><INDENT>site_regexes.append(cleaned_sites[site.pk][<NUM_LIT:0>])<EOL><DEDENT>sites = '<STR_LIT:|>'.join(site_regexes)<EOL>regex = re.compile('<STR_LIT>' % (sites, regex))<EOL>return regex<EOL>
Performs a reverse lookup on a named view and generates
a list of regexes that match that object.  It generates
regexes with the domain name included, using sites provided
by the get_sites() method.

>>> regex = provider.regex
>>> regex.pattern
'http://(www2.kusports.com|www2.ljworld.com|www.lawrence.com)/photos/(?P<year>\\d{4})/(?P<month>\\w{3})/(?P<day>\\d{1,2})/(?P<object_id>\\d+)/$'