Using RegExp to validate input with the JavaScript