private void findMatch(Function function, ClangLine line) {

			String textLine = PrettyPrinter.getText(line);
			Matcher matcher = pattern.matcher(textLine);
			if (!matcher.find()) {
				return;
			}

			LocationReferenceContextBuilder builder = new LocationReferenceContextBuilder();

			int start = matcher.start();
			int end = matcher.end();
			builder.append(textLine.substring(0, start));
			builder.appendMatch(textLine.substring(start, end));
			if (end < textLine.length()) {
				builder.append(textLine.substring(end));
			}

			int lineNumber = line.getLineNumber();
			AddressSet addresses = getAddresses(function, line);
			LocationReferenceContext context = builder.build();
			TextMatch match =
				new TextMatch(function, addresses, lineNumber, searchText, context, false);
			callback.accept(match);
		}
Uses the given matcher to search for all matches, which may span multiple lines.
Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/search/DecompilerTextFinder.java