public List<String> matchKeys(KeyPath path, boolean matchLength) {
		int length = pattern.size();
		if (matchLength ? length != path.size() : length > path.size()) {
			return null;
		}
		List<String> result = new ArrayList<>();
		for (int i = 0; i < length; i++) {
			String pat = pattern.key(i);
			String key = path.key(i);
			if (!PathFilter.keyMatches(pat, key)) {
				return null;
			}
			if (isWildcard(pat)) {
				if (KeyPath.isIndex(pat)) {
					result.add(KeyPath.parseIndex(key));
				}
				else {
					result.add(key);
				}
			}
		}
		return result;
	}
If the given path matches, extract keys where matched by wildcards

<p>
This is essentially the inverse of {@link #applyKeys(String...)}, but can only be asked of
one pattern. The keys are returned from left to right, in the order matched by the pattern.
Only those keys matched by a wildcard are included in the result. Indices are extracted with
the brackets {@code []} removed.

@param path the path to match
@param matchLength true if the path must have the same number of keys as this pattern, or
           false if the path is allowed to have more keys than this pattern
@return the list of matched keys or {@code null} if not matched
Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/PathPattern.java