Compile pattern before checking

If user's input is `/foo[bar` there is `PatternSyntaxException` thrown because of invalid regex (missing `]`). It should be catched because of ignoring invalid regexes (and do not return any files in result set).