private Highlight[] getAllHighlights(String text, int cursorTextOffset) {

			String searchText = searchOptions.getText();
			if (StringUtils.isBlank(searchText) || StringUtils.isBlank(text)) {
				return NO_HIGHLIGHTS;
			}

			List<Highlight> list = new ArrayList<>();
			Pattern regexp =
				UserSearchUtils.createSearchPattern(searchText, searchOptions.isCaseSensitive());
			Matcher matcher = regexp.matcher(text);
			while (matcher.find()) {
				int start = matcher.start();
				int end = matcher.end() - 1;
				Color hlColor = SearchConstants.SEARCH_HIGHLIGHT_COLOR;
				if (start <= cursorTextOffset && end >= cursorTextOffset) {
					// change the highlight color when in the field so it stands out
					hlColor = SearchConstants.SEARCH_HIGHLIGHT_CURRENT_ADDR_COLOR;
				}
				list.add(new Highlight(start, end, hlColor));
			}

			if (list.isEmpty()) {
				return NO_HIGHLIGHTS;
			}
			return list.toArray(Highlight[]::new);
		}
Get the address set for the selection.

@return null if there is no selection
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/searchtext/SearchTextPlugin.java