runtime/src/main/java/org/echocat/jomon/runtime/util/Glob.java
private void compilePattern() throws ParseException {
        StringBuilder sb = new StringBuilder();
        boolean escaped = false;
        final List<GlobPattern> patterns = new ArrayList<>();
        for (int a = 0; a < _patternSource.length(); a++) {
            final char c = _patternSource.charAt(a);
            
            // Test escape-char
            if (c == '\\') {
                if (escaped) {
                    sb.append('\\');
                    escaped = false;
                } else {
                    escaped = true;
                }
            } else {
                if (escaped) {
                    if (c != GLOB_SINGLE && c != GLOB_MULTIPLE) {
                        sb.append("\\");
                    } else {

                        // Globbing chars escaped
                        sb.append(c);
                        escaped = false;
                    }
                } else {

                    // No escape character, test whether it matches on of the globbing characters.
                    if (c == GLOB_MULTIPLE || c == GLOB_SINGLE) {
                        if (sb.length() > 0) {
                            patterns.add(new GlobPattern(TEXT, sb.toString()));
                            sb = new StringBuilder();
                        }
                        patterns.add(new GlobPattern(c));
                    } else {
                        sb.append(c);
                    }
                }
            }
        }
        if (sb.length() > 0) {
            patterns.add(new GlobPattern(TEXT, sb.toString()));
        }
        
        // Add meta information and correct the elements
        addMetaInformation(patterns);
        
        _compiledPattern = new GlobPattern[patterns.size()];
        patterns.toArray(_compiledPattern);
    }
private void compilePattern() throws ParseException {
        StringBuilder sb = new StringBuilder();
        boolean escaped = false;
        final List<GlobPattern> patterns = new ArrayList<>();
        for (int a = 0; a < _patternSource.length(); a++) {
            final char c = _patternSource.charAt(a);
            
            // Test escape-char
            if (c == '\\') {
                if (escaped) {
                    sb.append('\\');
                    escaped = false;
                } else {
                    escaped = true;
                }
            } else {
                if (escaped) {
                    if (c != GLOB_SINGLE && c != GLOB_MULTIPLE) {
                        sb.append("\\");
                    } else {

                        // Globbing chars escaped
                        sb.append(c);
                        escaped = false;
                    }
                } else {

                    // No escape character, test whether it matches on of the globbing characters.
                    if (c == GLOB_MULTIPLE || c == GLOB_SINGLE) {
                        if (sb.length() > 0) {
                            patterns.add(new GlobPattern(TEXT, sb.toString()));
                            sb = new StringBuilder();
                        }
                        patterns.add(new GlobPattern(c));
                    } else {
                        sb.append(c);
                    }
                }
            }
        }
        if (sb.length() > 0) {
            patterns.add(new GlobPattern(TEXT, sb.toString()));
        }
        
        // Add meta information and correct the elements
        addMetaInformation(patterns);
        
        _compiledPattern = new GlobPattern[patterns.size()];
        patterns.toArray(_compiledPattern);
    }
Compile the pattern into the strings[] and wildcard[] arrays.