remove spaces before comparing to regex