protected static Pattern makePattern ( String input ) { StringBuilder pattern = new StringBuilder ( ' ' ) ; while ( true ) { String [ ] parts = _splitter . split ( input , 2 ) ; pattern . append ( Pattern . quote ( parts [ 0 ] ) ) ; if ( parts . length == 1 ) { break ; } int length = parts [ 0 ] . length ( ) ; String wildcard = input . substring ( length , length + 1 ) ; if ( wildcard . equals ( "*" ) ) { pattern . append ( ".*" ) ; } else { System . err . println ( "Bad wildcard " + wildcard ) ; } input = parts [ 1 ] ; } pattern . append ( "$" ) ; return Pattern . compile ( pattern . toString ( ) ) ; }
Create a real regular expression from the dumbed down input .