The validator itself should probably also strip spaces before validating. That means it also functions as expected when used independently.