public static StringUtils.Pair parseVariableAndPath(String text) {
        Matcher matcher = VAR_AND_PATH_PATTERN.matcher(text);
        matcher.find();
        String name = text.substring(0, matcher.end());
        String path;
        if (matcher.end() == text.length()) {
            path = "";
        } else {
            path = text.substring(matcher.end()).trim();
        }
        if (isXmlPath(path) || isXmlPathFunction(path)) {
            // xml, don't prefix for json
        } else {
            path = "$" + path;
        }
        return StringUtils.pair(name, path);
    }
@Test
    void testParsingVariableAndJsonPath() {
        assertEquals(StringUtils.pair("foo", "$"), ScenarioEngine.parseVariableAndPath("foo"));
        assertEquals(StringUtils.pair("foo", "$.bar"), ScenarioEngine.parseVariableAndPath("foo.bar"));
        assertEquals(StringUtils.pair("foo", "$['bar']"), ScenarioEngine.parseVariableAndPath("foo['bar']"));
        assertEquals(StringUtils.pair("foo", "$[0]"), ScenarioEngine.parseVariableAndPath("foo[0]"));
        assertEquals(StringUtils.pair("foo", "$[0].bar"), ScenarioEngine.parseVariableAndPath("foo[0].bar"));
        assertEquals(StringUtils.pair("foo", "$[0]['bar']"), ScenarioEngine.parseVariableAndPath("foo[0]['bar']"));
        assertEquals(StringUtils.pair("foo", "/bar"), ScenarioEngine.parseVariableAndPath("foo/bar"));
        assertEquals(StringUtils.pair("foo", "/"), ScenarioEngine.parseVariableAndPath("foo/"));
        assertEquals(StringUtils.pair("foo", "/"), ScenarioEngine.parseVariableAndPath("foo /"));
        assertEquals(StringUtils.pair("foo", "/bar"), ScenarioEngine.parseVariableAndPath("foo /bar"));
        assertEquals(StringUtils.pair("foo", "/bar/baz[1]/ban"), ScenarioEngine.parseVariableAndPath("foo/bar/baz[1]/ban"));
    }