private boolean validateRegex(String text) {

		if (!isRegex()) {
			return true;
		}

		try {
			Pattern.compile(text);
			return true;
		}
		catch (PatternSyntaxException e) {
			setStatusText("Invalid regex: " + e.getMessage(), MessageType.ERROR);
			return false;
		}
	}
A dialog to gather input for performing a search over decompiled text.
Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinderDialog.java