## Bug description

*Please describe.*  
*If this affects the front-end, screenshots would be of great help.*  

Trailing spaces in the selector box are not removed automatically and can mess up the event results when saving an action

## Expected behavior



## How to reproduce

1. Create a new action with any selector
2. put in a couple of spaces at the end of the line in the selector input box
3. 

## Environment

- Self-managed?
- PostHog version/commit

## Additional context



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

posthog/models/event.py
import copy
import datetime
import random
import re
import string
from collections import defaultdict
from typing import Any, Dict, List, Optional, Tuple, Union
import celery
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.core.cache import cache
from django.db import connection, models, transaction
from django.db.models import (