This should probably be `/\.(^[.]+)$/`

The first `.` is actually matching any character causing probably much more backtrack than is needed: http://jsperf.com/regexp-backtrack-test-case

Also, the escape on the `.` is not needed inside of a regexp class (`[.]` matches `'.'` only)