code: def renavactive(request, pattern):
      
      if re.search(pattern, request.path):
          return getattr(settings, "NAVHELPER_ACTIVE_CLASS", "active")
      return getattr(settings, "NAVHELPER_NOT_ACTIVE_CLASS", "")
docs: {% renavactive request "^/a_regex" %}