public static boolean isAppropriate(String target, String path) {
        Pattern targetPattern = Pattern.compile(DELIMITER_PATTERN);
        Matcher targetMatcher = targetPattern.matcher(target);

        Pattern pathPattern = Pattern.compile(DELIMITER_PATTERN);
        Matcher pathMatcher = pathPattern.matcher(path);

        int prevPathIndex = 0;
        int prevTargetIndex = 0;
        while (pathMatcher.find(prevPathIndex)) {
            if (!targetMatcher.find(prevTargetIndex)) {
                return false;
            }

            prevPathIndex = pathMatcher.end();
            prevTargetIndex = targetMatcher.end();

            final String pathEl = pathMatcher.find()
                    ? path.substring(prevPathIndex, pathMatcher.end() - 1)
                    : path.substring(prevPathIndex);

            final String targetEl = targetMatcher.find()
                    ? target.substring(prevTargetIndex, targetMatcher.end() - 1)
                    : target.substring(prevTargetIndex);

            if (targetEl.isEmpty() || pathEl.isEmpty())
                return false;

            if (targetEl.charAt(0) == '$') {
                continue;
            }

            if (!targetEl.equals(pathEl)) {
                return false;
            }
        }

        if (targetMatcher.find(prevTargetIndex))
            return false;

        return true;
    }