@Override
		public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
			// allow pasting numbers in forms like 0xABC or ABCh
			str = removeNumberBasePrefixAndSuffix(str);

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

			ByteMatcher byteMatcher = model.parse(proposedText);
			if (!byteMatcher.isValidInput()) {
				reportInputError(byteMatcher.getDescription());
				return;
			}
			super.insertString(offs, str, a);

			setByteMatcher(byteMatcher);
		}
Called before new user input is inserted into the entry text field.  The super
method is called if the input is accepted.
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchControlPanel.java