Validate for empty space

Hello, We have a text field which users need to enter a particular numeric entry (example: 79597) What is happening at times is users are pasting the entry from an email or word doc and including a space at the end. Is there a validation that I can add to this custom field that will check for empty spaces and prompt a user with a message? Thanks for your help.