protected static String createRegex(String endpoint, boolean meta) {
        StringBuilder regex = new StringBuilder();

        regex.append('^');

        for (int i=0; i < endpoint.length(); i++) {
            char ch=endpoint.charAt(i);
            if ("*".indexOf(ch) != -1) {
                regex.append('.');
            } else if ("\\.^$|?+[]{}()".indexOf(ch) != -1) {
                regex.append('\\');
            }
            regex.append(ch);
        }

        regex.append('$');

        return regex.toString();
    }
protected static String createRegex ( String endpoint , boolean meta ) { StringBuilder regex = new StringBuilder ( ) ; regex . append ( '^' ) ; for ( int i = 0 ; i < endpoint . length ( ) ; i ++ ) { char ch = endpoint . charAt ( i ) ; if ( "*" . indexOf ( ch ) != - 1 ) { regex . append ( '.' ) ; } else if ( "\\.^$|?+[]{}()" . indexOf ( ch ) != - 1 ) { regex . append ( '\\' ) ; } regex . append ( ch ) ; } regex . append ( '$' ) ; return regex . toString ( ) ; }
This method derives the regular expression from the supplied
URI.

@param endpoint The endpoint
@param meta Whether this is a meta endpoint
@return The regular expression