private Set<String> getVariables() {
        final Matcher matcher = VARIABLE_PATTERN.matcher(format);
        final Set<String> variables = new LinkedHashSet<>();
        while (matcher.find()) {
            final String varName = matcher.group(1);
            if (varName != null && !varName.equals(FROM_BY)) {
                variables.add(varName);
            }
        }
        return variables;
    }
Reference implementation for String format step, a mid-traversal step which will handle result formatting
to string values. If the incoming traverser is a non-String value then an {@code IllegalArgumentException}
will be thrown.

@author Valentyn Kahamlyk
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/FormatStep.java