HFS: File masks
What is it?
A file mask denotes a set of files. It is something like this: *.jpg;*.gif. This example denotes any jpeg and gif files.
How does it work?
The example above shows a double file mask. It has two atoms separated by the semicolon: *.jpg and *.gif. The semicolon is used to merge multiple masks: it is a special character. There are only 3 special characters in file masks: ; * and ?.
The star (*)
stands for any string of characters. If the mask contains only the star, it would match ANY file.
If you put an A before the star A*, it matches any file starting with an A.
If you put an A after the star *A, it matches any file ending with an A.
Moreover A*B matches any file starting with an A and ending with a B. In the example above, you find *.jpg : it matches any file ending with .jpg that is jpeg images. Well, know that jpeg files sometimes ends with .jpeg and rarely with .jpe .
The star matches also the null string: a*.jpg matches files like a1.jpg , adfgg.jpg but also a.jpg , where the star has been replaced with nothing.
The question point (?)
stands for a single character. Something like A?B matches any 3 chars long filename, starting with an A and ending with a B. The length is fixed to 3 characters because ? can be replaced by only one single character. Thus the ? does not match the null string as the * does.