## Bug description

The following filter fails with a 500 internal error.

![2021-02-04_12-07](https://user-images.githubusercontent.com/148820/106877644-a9f4ce80-66e1-11eb-8320-87bb213bdde2.png)


## Expected behavior

Error is shown to user about invalid regular expression.

Note no errors shown on the page as well.

## How to reproduce

1. Go to events
2. Add filter "Current URL matches regular expression ?*"
3. See infinite loading screen / error

## Environment

- [x] PostHog Cloud
- [x] self-hosted PostHog, version/commit: _please provide_

## Additional context

Note this can also happen when filtering by events.

#### *Thank you* for your bug report – we love squashing them!

posthog/utils.py
from posthog.models import Team
    template = get_template(template_name)
    
    team: Optional[Team] = None
    try:
        team = request.user.team  
    except (Team.DoesNotExist, AttributeError):
        team = Team.objects.first()
    if os.environ.get("OPT_OUT_CAPTURE"):
        
        context["opt_out_capture"] = True
    else:
        context["opt_out_capture"] = team.opt_out_capture if team else False
    if settings.SOCIAL_AUTH_GITHUB_KEY and settings.SOCIAL_AUTH_GITHUB_SECRET:
        context["github_auth"] = True
    if settings.SOCIAL_AUTH_GITLAB_KEY and settings.SOCIAL_AUTH_GITLAB_SECRET:
        context["gitlab_auth"] = True
    if getattr(settings, "SOCIAL_AUTH_GOOGLE_OAUTH2_KEY", None) and getattr(
        settings, "SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET", None
    ):
        if settings.MULTI_TENANCY:
            context["google_auth"] = True
        else:
            google_login_paid_for = False
            try:
                from ee.models.license import License
            except ImportError:
                pass
            else:
                license = License.objects.first_valid()