@Override
		public void remove(int offs, int len) throws BadLocationException {
			clearInputError();

			String currentText = getText(0, getLength());
			String beforeOffset = currentText.substring(0, offs);
			String afterOffset = currentText.substring(len + offs, currentText.length());
			String proposedResult = beforeOffset + afterOffset;

			if (proposedResult.length() == 0) {
				super.remove(offs, len);
				setByteMatcher(new InvalidByteMatcher(""));
				return;
			}

			ByteMatcher byteMatcher = model.parse(proposedResult);
			if (!byteMatcher.isValidInput()) {
				reportInputError(byteMatcher.getDescription());
				return;
			}
			super.remove(offs, len);
			setByteMatcher(byteMatcher);
		}
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