code: public static String spacesOptional(final String input) {
  		String output;
  		output = input.replaceAll("\\s", "\\\\s?");
  		return output;
  	}
docs: Replaces a space with the regular expression \\s?
  
  @param input
  the string to modify
  @return the input string with all spaces replaced by \\s?