question: public static String createDestinationForFoldername ( String template , Movie movie ) { Pattern regex = Pattern . compile ( "\\{(.*?)\\}" ) ; Matcher mat = regex . matcher ( template ) ; while ( mat . find ( ) ) { template = template . replace ( mat . group ( 0 ) , replaceOptionalVariable ( mat . group ( 1 ) , movie , false ) ) ; } return createDestination ( template , movie , false ) ; }
target:  Creates the new filename according to template string