public static SubstituteString create(String value) {
        int lastEnd = 0;
        int start = value.indexOf("%{");
        if (start < 0) return null; // Shortcut
        List<Component> components = new ArrayList<>();
        while (start >= 0) {
            int end = value.indexOf("}", start + 2);
            if (end < 0)
                throw new IllegalArgumentException("Unterminated value substitution '" + value.substring(start) + "'");
            String propertyName = value.substring(start + 2, end);
            if (propertyName.contains("%{"))
                throw new IllegalArgumentException("Unterminated value substitution '" + value.substring(start) + "'");
            components.add(new StringComponent(value.substring(lastEnd, start)));
            if (propertyName.startsWith("."))
                components.add(new RelativePropertyComponent(propertyName.substring(1)));
            else
                components.add(new PropertyComponent(propertyName));
            lastEnd = end + 1;
            start = value.indexOf("%{", lastEnd);
        }
        components.add(new StringComponent(value.substring(lastEnd)));
        return new SubstituteString(components, value);
    }
Returns a new SubstituteString if the given string contains substitutions, null otherwise.
container-search/src/main/java/com/yahoo/search/query/profile/SubstituteString.java