RegEx explanation

Here I found a regular expression that matches all files that name starts with a dot.


Could anyone explain what does the ((?!\).)* part do?
I would rather use [^]* instead but I'm very interested in knowing what the above code does.

That's a "negative assert", described in detail here.

The whole regexp is basically saying, find the last backslash in the path, then find a dot after it, then find any any other characters as long as they are not backslashes.

It seems like an over-complicated way of expressing quite a simple thing, but maybe there is some reason they've chosen to do it that way.

Note that if you're really testing filenames, not full file paths, then that regexp is unsuitable as there won't be any backslashes in a filename.

Thanks for explanation.