Glob pattern to match all files that do not start with prefix

I want to use glob pattern to match all the files in src/ folder that do not start with prefix of two uppercase letters followed by a dot.

The glob should match the following files


But it should not match the following files:

The prefix will always be two uppercase letters (A to Z) followed by a dot.


glob() can mostly do what you’re looking for, but with some limitations.

You can do this:


which would exclude any files that start with two uppercase letter followed by a dot. However, this particular syntax will also exclude any files with less than 3 characters in the filename. Globbing is similar to shell filename globbing syntax, and in a shell what you’re looking for is more often accomplished with find or grep.

If glob() isn’t flexible enough, you’d have to glob all files and pattern match on your own.