protected String match(Pattern pat) {
			Matcher mat = pat.matcher(buf);
			if (!mat.lookingAt()) {
				throw new IllegalArgumentException("Expecting " + pat + ", but had " + buf);
			}
			String tok = mat.group();
			int length = mat.end() - mat.start();
			buf.position(buf.position() + length);
			return tok;
		}
Sort paths by length, longest first, then as in {@link #KEYED}.
Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/target/path/KeyPath.java