private Highlight[] getSingleSearchHighlight(String text, ListingField field,
				int cursorTextOffset) {

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

			FieldFactory fieldFactory = field.getFieldFactory();
			ProgramLocation loc = searchResult.programLocation();
			if (!fieldFactory.supportsLocation(field, loc)) {
				return NO_HIGHLIGHTS;
			}

			int charOffset = searchResult.offset();
			int searchStart = charOffset;
			int searchEnd = searchStart + searchText.length();

			Pattern regexp =
				UserSearchUtils.createSearchPattern(searchText, searchOptions.isCaseSensitive());
			Matcher matcher = regexp.matcher(text);
			while (matcher.find()) {
				int start = matcher.start();
				int end = matcher.end();

				// ensure the particular regex match is the actual search result
				if (start == searchStart && end == searchEnd) {

					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;
					}

					// this is the matching search hit for a single search
					int endEx = end - 1;
					return new Highlight[] { new Highlight(start, endEx, hlColor) };
				}
			}
			return NO_HIGHLIGHTS;
		}
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