Fork me on GitHub
#beginners
<
2015-07-04
>
adi05:07:33

@meow: Since we are dealing with conventionally structured text[1], I tried another way.

(let [allowed-filetypes #{"clj" "cljc" "cljs"}]
  (filter #(allowed-filetypes (last (re-seq #"\w+" %)))
          ["~/bin/foo.bar.cljjjjj" "/to/file-root/foo.bar.cljc" "~/baz.quxx.clj" "file:///gurk.phew.c" "file:///baz.munge.cljc" "file:///foo.baz.html"]))
[1] A file extension is always the last part of the filename, and always dot separated. IMHO, this also feels more robust, maintainable, and extensible than the regex alternative (only for this structured text use case).