public boolean validateInput(String input) {

		String text = input.trim();

		if (text.isEmpty()) {
			errorMsg = ERROR_NO_INPUT;
			return false;
		}
		if (selectionModeWidget.getInputMode() == InputMode.BINARY) {

			// Get the byte groups and check them for validity. Note that this method throws an
			// exception if there's a problem with the groups, so there's no need to check
			// the return values.
			try {
				InstructionSearchUtils.getGroupSizes(text, InputMode.BINARY);
			}
			catch (Exception e) {
				inputBytesTA.setError();
				errorMsg = ERROR_MSG_GROUPS;
				return false;
			}

			if (!InstructionSearchUtils.isBinary(text)) {
				inputBytesTA.setError();
				errorMsg = ERROR_MSG_BINARY_INPUT;
				return false;
			}
			if (!InstructionSearchUtils.isFullBinaryByte(text)) {
				inputBytesTA.setError();
				errorMsg = ERROR_MSG_FULL_BYTE;
				return false;
			}
		}
		else if (selectionModeWidget.getInputMode() == InputMode.HEX) {

			// Get the byte groups and check them for validity. Note that this method throws an
			// exception if there's a problem with the groups, so there's no need to check
			// the return values.
			try {
				InstructionSearchUtils.getGroupSizes(text, InputMode.HEX);
			}
			catch (Exception e) {
				inputBytesTA.setError();
				errorMsg = ERROR_MSG_GROUPS;
				return false;
			}

			if (!InstructionSearchUtils.isHex(text)) {
				inputBytesTA.setError();
				errorMsg = ERROR_MSG_HEX_INPUT;
				return false;
			}
			if (!InstructionSearchUtils.isFullHexByte(text)) {
				inputBytesTA.setError();
				errorMsg = ERROR_MSG_FULL_BYTE;
				return false;
			}
		}

		// If we're here then it's in good shape.
		inputBytesTA.setValid();
		errorMsg = "";
		return true;
	}
Verifies that the given string is valid binary or hex input.

@param input the string to validate
@return true if valid
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/instructionsearch/ui/InsertBytesWidget.java