public static String cleanPathSegment(final String toClean) {
        final String cleaned = toClean.replaceAll("[.\\\\/:*?\"<>|\\[\\]\\(\\)]", "");
        if (cleaned.length() == 0)
            throw new IllegalStateException("Path segment " + toClean + " has not valid characters and is thus empty");
        return cleaned;
    }
Removes characters that aren't acceptable in a file path (mostly for windows).
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TestSupport.java