private String removeNumberBasePrefixAndSuffix(String str) {
			SearchFormat format = model.getSearchFormat();
			if (!(format == SearchFormat.HEX || format == SearchFormat.BINARY)) {
				return str;
			}

			String numMaybe = str.strip();
			String lowercase = numMaybe.toLowerCase();
			if (format == SearchFormat.HEX) {
				if (lowercase.startsWith("0x")) {
					numMaybe = numMaybe.substring(2);
				}
				else if (lowercase.startsWith("$")) {
					numMaybe = numMaybe.substring(1);
				}
				else if (lowercase.endsWith("h")) {
					numMaybe = numMaybe.substring(0, numMaybe.length() - 1);
				}
			}
			else {
				if (lowercase.startsWith("0b")) {
					numMaybe = numMaybe.substring(2);
				}
			}

			// check if the resultant number looks valid for insertion (i.e. not empty)
			if (!numMaybe.isEmpty()) {
				return numMaybe;
			}
			return str;
		}
Called before the user deletes some text.  If the result is valid, the super
method is called.
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchControlPanel.java