code: public static String nullifyBadInput(String input)
      {
          if (input != null)
          {
              if (input.matches(emptyRegex))
              {
                  return null;
              }
              return input.trim();
          }
          return null;
      }
docs: Returns a valid string or null, if empty
  
  @param input original string
  @return resultant string