title: NoReverseMatch at /
body: <p>I am trying to make pretty meaningful urls, but I guess I'm doing it wrong.</p>
  
  <p>This works:</p>
  
  <pre><code>from django.conf.urls.defaults import patterns, url
  from places.views import explore_view
  
  urlpatterns = patterns('',
      url(r'', explore_view, name='explore'),
  )
  </code></pre>
  
  <p>This does not:</p>
  
  <pre><code>from django.conf.urls.defaults import patterns, url
  from places.views import explore_view
  
  urlpatterns = patterns('',
      url(r'(?P&lt;countryorcategory&gt;[0-9A-Za-z._%+-]+)', explore_view, name='explore'),
  )
  </code></pre>
  
  <p>As I get this error:</p>
  
  <blockquote>
    <p>Reverse for 'explore' with arguments '()' and keyword arguments '{}'
    not found.</p>
  </blockquote>
  
  <p>Here is the code for explore_view:</p>
  
  <pre><code>def explore_view(request, countryorcategory=None):
      """
      This is the explore view - to view places sugeested by ambassadors
      """
      user = request.user
      page = request.GET.get("page", 1)
      per_page = request.GET.get("per_page", 20)
      category_id = request.GET.get("category_id", None)
  
      attrs = request.GET
      lat = safe_attr(attrs, "lat", "float", None)
      lon = safe_attr(attrs, "lon", "float", None)
      q = request.GET.get('q', None)
  
      if q and not lat or lon:
          cache_key = 'GoogleGeocode-{}'.format(hashlib.md5(q.encode('UTF-8', 'replace')).hexdigest())
          latlon = cache.get(cache_key)
          if not latlon:
              latlon = geocode(q)
              if latlon:
                  cache.set(cache_key, latlon)
          if latlon:
              lat = latlon['lat']
              lon = latlon['lng']
  
      if not q:
          q = ''
  
      category_names = getattr(settings, "EXPLORE_CATEGORIES", [])
      categories = [Category.objects.get(name=cat_name).serialize() for cat_name in category_names]
  
      more = True
      places = Place.objects.explore_places(user, category_id=category_id, lat=lat, lon=lon, page=page, per_page=20)
  
      if len(places) != per_page:
          more = False
  
      return render_to_response('explore/main.html', {'places': places, 'categories': categories, 'category_id': category_id, 'lat': lat, 'lon': lon, 'more': more, 'q': q}, RequestContext(request))
  </code></pre>