question: private String globToRegex ( String glob ) { if ( glob . charAt ( 0 ) == '.' || glob . contains ( "/" ) || glob . contains ( "~" ) ) { throw new IllegalArgumentException ( "Invalid character in file glob" ) ; } glob = glob . replace ( "." , "\\." ) ; glob = glob . replace ( "*" , ".+" ) ; glob = glob . replace ( "?" , ".{1}+" ) ; return glob ; }
target:  Convert a limited file glob into a simple regex.