added pattern matching for number and server validation for input